Boot.php

  1. 8.0.x lib/Drush/Boot/Boot.php
  2. 7.x lib/Drush/Boot/Boot.php
  3. master lib/Drush/Boot/Boot.php

Namespace

Drush\Boot

Interfaces

Namesort descending Description
Boot Defines the interface for a Boot classes. Any CMS that wishes to work with Drush should extend BaseBoot. If the CMS has a Drupal-Compatibility layer, then it should extend DrupalBoot.

File

lib/Drush/Boot/Boot.php
View source
  1. <?php
  2. namespace Drush\Boot;
  3. /**
  4. * Defines the interface for a Boot classes. Any CMS that wishes
  5. * to work with Drush should extend BaseBoot. If the CMS has a
  6. * Drupal-Compatibility layer, then it should extend DrupalBoot.
  7. *
  8. * @todo Doc these methods.
  9. */
  10. interface Boot {
  11. /**
  12. * This function determines if the specified path points to
  13. * the root directory of a CMS that can be bootstrapped by
  14. * the specific subclass that implements it.
  15. *
  16. * These functions should be written such that one and only
  17. * one class will return TRUE for any given $path.
  18. *
  19. * @param $path to a directory to test
  20. *
  21. * @return TRUE if $path is a valid root directory
  22. */
  23. function valid_root($path);
  24. /**
  25. * Main entrypoint to bootstrap the selected CMS and
  26. * execute the selected command.
  27. *
  28. * The implementation provided in BaseBoot should be
  29. * sufficient; this method usually will not need to
  30. * be overridden.
  31. */
  32. function bootstrap_and_dispatch();
  33. /**
  34. * Returns an array that determines what bootstrap phases
  35. * are necessary to bootstrap this CMS. This array
  36. * should map from a numeric phase to the name of a method
  37. * (string) in the Boot class that handles the bootstrap
  38. * phase.
  39. *
  40. * @see \Drush\Boot\DrupalBoot::bootstrap_phases()
  41. *
  42. * @return array of PHASE index => method name.
  43. */
  44. function bootstrap_phases();
  45. /**
  46. * Lists the key bootstrap phases where Drush should
  47. * stop and look for more commandfiles. In Drupal, Drush
  48. * first does just a preflight, and if the selected
  49. * command is not found after preflight, then a full
  50. * bootstrap is done.
  51. *
  52. * @return array of PHASE indexes.
  53. */
  54. function bootstrap_init_phases();
  55. /**
  56. * Return an array of default values that should be added
  57. * to every command (e.g. values needed in enforce_requirements(),
  58. * etc.)
  59. */
  60. function command_defaults();
  61. /**
  62. * Called by Drush when a command is selected, but
  63. * before it runs. This gives the Boot class an
  64. * opportunity to determine if any minimum
  65. * requirements (e.g. minimum Drupal version) declared
  66. * in the command have been met.
  67. *
  68. * @return TRUE if command is valid. $command['bootstrap_errors']
  69. * should be populated with an array of error messages if
  70. * the command is not valid.
  71. */
  72. function enforce_requirement(&$command);
  73. /**
  74. * Called by Drush if a command is not found, or if the
  75. * command was found, but did not meet requirements.
  76. *
  77. * The implementation in BaseBoot should be sufficient
  78. * for most cases, so this method typically will not need
  79. * to be overridden.
  80. */
  81. function report_command_error($command);
  82. /**
  83. * This method is called during the shutdown of drush.
  84. *
  85. * @return void
  86. */
  87. public function terminate();
  88. }