Skip to content

Commit

Permalink
#342: Call drush_preflight() before creating the bootstrap class. Thi…
Browse files Browse the repository at this point in the history
…s insures that all of the command files are loaded first, which will open the way to allow us to instantiate the bootstrap class via a hook.
  • Loading branch information
greg-1-anderson committed Jan 23, 2015
1 parent e3a2e09 commit 2c3ec33
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drush.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions includes/command.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 2c3ec33

Please sign in to comment.