diff --git a/drush.php b/drush.php index a6be5a17b4..00c4e7f6c1 100755 --- a/drush.php +++ b/drush.php @@ -38,6 +38,9 @@ function drush_main() { register_shutdown_function('drush_coverage_shutdown'); } + // Load the Drush configuration files. + drush_preflight(); + /* Set up bootstrap object, so that * - 'early' files can bootstrap when needed. * - bootstrap constants are available. @@ -48,8 +51,6 @@ function drush_main() { $bootstrap->preflight(); $return = ''; - // Load the Drush configuration files. - drush_preflight(); if (!drush_get_error()) { if ($file = drush_get_option('early', FALSE)) { require_once $file; diff --git a/includes/command.inc b/includes/command.inc index f64e9f95f1..b1ddb7405f 100644 --- a/includes/command.inc +++ b/includes/command.inc @@ -1060,6 +1060,14 @@ function drush_command_defaults($key, $commandfile, $path) { 'hidden' => FALSE, 'category' => $commandfile, ); + // We end up here, setting the defaults for a command, when + // called from drush_get_global_options(). Early in the Drush + // bootstrap, there will be no bootstrap object, because we + // need to get the list of global options when loading config + // files, and config files are loaded before the bootstrap object + // is created. In this early stage, we just use the core global + // options list. Later, the bootstrap object can also provide + // additional defaults if needed. if ($bootstrap = drush_get_context('DRUSH_BOOTSTRAP_OBJECT')) { $defaults = array_merge($defaults, $bootstrap->command_defaults()); }