Skip to content

Commit

Permalink
Move bootstrap object creation into a separate function.
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-1-anderson committed Feb 25, 2015
1 parent 347fab1 commit a877d37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 1 addition & 4 deletions drush.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ function drush_main() {
* - 'early' files can bootstrap when needed.
* - bootstrap constants are available.
*/
$bootstrap_class = drush_get_option('bootstrap_class', 'Drush\Boot\DrupalBoot');
$bootstrap = new $bootstrap_class;
drush_set_context('DRUSH_BOOTSTRAP_OBJECT', $bootstrap);
$bootstrap = drush_preflight_create_bootstrap_object();
$bootstrap->preflight();

$return = '';
Expand All @@ -70,7 +68,6 @@ function drush_main() {
// perhaps handling immediately.
$command_handled = drush_preflight_command_dispatch();
if (!$command_handled) {
$bootstrap = drush_get_context('DRUSH_BOOTSTRAP_OBJECT');
$return = $bootstrap->bootstrap_and_dispatch();
}
}
Expand Down
7 changes: 7 additions & 0 deletions includes/preflight.inc
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ function drush_preflight() {
_drush_find_commandfiles_drush();
}

function drush_preflight_create_bootstrap_object() {
$bootstrap_class = drush_get_option('bootstrap_class', 'Drush\Boot\DrupalBoot');
$bootstrap = new $bootstrap_class;
drush_set_context('DRUSH_BOOTSTRAP_OBJECT', $bootstrap);
return $bootstrap;
}

function _drush_preflight_global_options() {
// Debug implies verbose
drush_set_context('DRUSH_VERBOSE', drush_get_option(array('verbose', 'debug'), FALSE));
Expand Down

0 comments on commit a877d37

Please sign in to comment.