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. * Given a site root directory, determine the exact version of the software.
  26. *
  27. * @param string $root
  28. * The full path to the site installation, with no trailing slash.
  29. * @return string|NULL
  30. * The version string for the current version of the software, e.g. 8.1.3
  31. */
  32. function get_version($root);
  33. /**
  34. * Main entrypoint to bootstrap the selected CMS and
  35. * execute the selected command.
  36. *
  37. * The implementation provided in BaseBoot should be
  38. * sufficient; this method usually will not need to
  39. * be overridden.
  40. */
  41. function bootstrap_and_dispatch();
  42. /**
  43. * Returns an array that determines what bootstrap phases
  44. * are necessary to bootstrap this CMS. This array
  45. * should map from a numeric phase to the name of a method
  46. * (string) in the Boot class that handles the bootstrap
  47. * phase.
  48. *
  49. * @see \Drush\Boot\DrupalBoot::bootstrap_phases()
  50. *
  51. * @return array of PHASE index => method name.
  52. */
  53. function bootstrap_phases();
  54. /**
  55. * List of bootstrap phases where Drush should stop and look for commandfiles.
  56. *
  57. * This allows us to bootstrap to a minimum neccesary to find commands.
  58. *
  59. * Once a command is found, Drush will ensure a bootstrap to the phase
  60. * declared by the command.
  61. *
  62. * @return array of PHASE indexes.
  63. */
  64. function bootstrap_init_phases();
  65. /**
  66. * Return an array of default values that should be added
  67. * to every command (e.g. values needed in enforce_requirements(),
  68. * etc.)
  69. */
  70. function command_defaults();
  71. /**
  72. * Called by Drush when a command is selected, but
  73. * before it runs. This gives the Boot class an
  74. * opportunity to determine if any minimum
  75. * requirements (e.g. minimum Drupal version) declared
  76. * in the command have been met.
  77. *
  78. * @return TRUE if command is valid. $command['bootstrap_errors']
  79. * should be populated with an array of error messages if
  80. * the command is not valid.
  81. */
  82. function enforce_requirement(&$command);
  83. /**
  84. * Called by Drush if a command is not found, or if the
  85. * command was found, but did not meet requirements.
  86. *
  87. * The implementation in BaseBoot should be sufficient
  88. * for most cases, so this method typically will not need
  89. * to be overridden.
  90. */
  91. function report_command_error($command);
  92. /**
  93. * This method is called during the shutdown of drush.
  94. *
  95. * @return void
  96. */
  97. public function terminate();
  98. }