-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Load the autoloader as soon as the Drupal root is identified. #2865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
d490d25
22fda8b
501e935
90a1e71
2fda2a5
b51e261
d7a112b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -497,19 +497,9 @@ function drush_preflight() { | |
| drush_preflight_site(); | ||
|
|
||
| // Check to see if anything changed during the 'site' preflight | ||
| // that might allow us to find our alias record now | ||
| // that might allow us to find our alias record now. | ||
| if (empty($alias_record)) { | ||
| $alias_record = _drush_sitealias_set_context_by_name($target_alias); | ||
|
|
||
| // If the site alias settings changed late in the preflight, | ||
| // then run the preflight for the root and site contexts again. | ||
| if (!empty($alias_record)) { | ||
| $remote_host = drush_get_option('remote-host'); | ||
| if (!isset($remote_host)) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Edge case: a site alias defined in an alias file in a local Drupal site (identified via This code re-runs the preflight steps that sets up to bootstrap the selected Drupal site. I feel this makes the preflight harder to maintain, and prefer to remove it. |
||
| drush_preflight_root(); | ||
| drush_preflight_site(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Fail if we could not find the selected site alias. | ||
|
|
@@ -544,6 +534,9 @@ function drush_preflight() { | |
| function drush_preflight_root() { | ||
| $root = drush_get_option('root'); | ||
| Drush::bootstrapManager()->locateRoot($root); | ||
| // Load the autoload file and provide it to the bootstrap manager. | ||
| $siteAutoloader = drush_drupal_load_autoloader($root); | ||
| Drush::bootstrapManager()->setAutoloader($siteAutoloader); | ||
|
|
||
| // Load the config options from Drupal's /drush, ../drush, and sites/all/drush directories, | ||
| // even prior to bootstrapping the root. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
| namespace Drush\Boot; | ||
|
|
||
| interface AutoloaderAwareInterface | ||
| { | ||
| public function setAutoloader($loader); | ||
|
|
||
| public function autoloader(); | ||
|
|
||
| public function hasAutoloader(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?php | ||
| namespace Drush\Boot; | ||
|
|
||
| trait AutoloaderAwareTrait | ||
| { | ||
| protected $loader; | ||
|
|
||
| public function setAutoloader($loader) | ||
| { | ||
| $this->loader = $loader; | ||
| } | ||
|
|
||
| public function autoloader() | ||
| { | ||
| return $this->loader; | ||
| } | ||
|
|
||
| public function hasAutoloader() | ||
| { | ||
| return false; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in requireed