6 * Defines the interface for a Boot classes. Any CMS that wishes
7 * to work with Drush should extend BaseBoot. If the CMS has a
8 * Drupal-Compatibility layer, then it should extend DrupalBoot.
10 * @todo Doc these methods.
14 * This function determines if the specified path points to
15 * the root directory of a CMS that can be bootstrapped by
16 * the specific subclass that implements it.
18 * These functions should be written such that one and only
19 * one class will return TRUE for any given $path.
21 * @param $path to a directory to test
23 * @return TRUE if $path is a valid root directory
25 function valid_root($path);
29 * Given a site root directory, determine the exact version of the software.
32 * The full path to the site installation, with no trailing slash.
34 * The version string for the current version of the software, e.g. 8.1.3
36 function get_version($root);
39 * Main entrypoint to bootstrap the selected CMS and
40 * execute the selected command.
42 * The implementation provided in BaseBoot should be
43 * sufficient; this method usually will not need to
46 function bootstrap_and_dispatch();
49 * Returns an array that determines what bootstrap phases
50 * are necessary to bootstrap this CMS. This array
51 * should map from a numeric phase to the name of a method
52 * (string) in the Boot class that handles the bootstrap
55 * @see \Drush\Boot\DrupalBoot::bootstrap_phases()
57 * @return array of PHASE index => method name.
59 function bootstrap_phases();
62 * List of bootstrap phases where Drush should stop and look for commandfiles.
64 * This allows us to bootstrap to a minimum neccesary to find commands.
66 * Once a command is found, Drush will ensure a bootstrap to the phase
67 * declared by the command.
69 * @return array of PHASE indexes.
71 function bootstrap_init_phases();
74 * Return an array of default values that should be added
75 * to every command (e.g. values needed in enforce_requirements(),
78 function command_defaults();
81 * Called by Drush when a command is selected, but
82 * before it runs. This gives the Boot class an
83 * opportunity to determine if any minimum
84 * requirements (e.g. minimum Drupal version) declared
85 * in the command have been met.
87 * @return TRUE if command is valid. $command['bootstrap_errors']
88 * should be populated with an array of error messages if
89 * the command is not valid.
91 function enforce_requirement(&$command);
94 * Called by Drush if a command is not found, or if the
95 * command was found, but did not meet requirements.
97 * The implementation in BaseBoot should be sufficient
98 * for most cases, so this method typically will not need
101 function report_command_error($command);
104 * This method is called during the shutdown of drush.
108 public function terminate();