-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow Drush to search recursively inside any specified alias path. #1480
Conversation
I think the proposed implementation looks good.
|
…o search for alias files. Add documentation in example.aliases.drushrc.php.
I agree that we should not backport this. If someone strongly desires this behavior in an older version of Drush, we could consider turning it on with an option. At that point, though, you might as well set $options['alias-path'] in your drushrc.php, and explicitly list all of the folders you want searched. So, probably no backport. I made the changes you suggested in #1 and #2 in the commit above. |
* for alias files. | ||
*/ | ||
public function testDeepAliasSearching() { | ||
$aliasPath = UNISH_SANDBOX . '/aliases'; |
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.
should this be site-aliases?
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.
No; this is passed as --alias-path, which is always searched recursively, regardless of whether there is a 'site-aliases' directory or not (since the path was explicitly provided by the user).
I could change this to '/site-alias-directory' or something like that, for the avoidance of doubt.
Ready to merge after you address the minor line comments above. |
Currently, Drush only considers alias files that appear immediately inside any given alias searchpath directory. This PR expands the search to include any directory that is anywhere deep inside any specified searchpath directory.
For the most part, this should not cause Drush to search for alias files too deeply. The current default alias search path only includes folders that are specific to Drush. For example:
I'm not sure why Drush searches its own directory for aliases, but it does.
These directories do, for the most part, only contain Drush files, and therefore should not be too crowded with deeply-nested folders. The one exception here is $HOME/.drush, which might contain a 'vendor' directory if folks use the recommended
cd $HOME/.drush && composer include ...
technique to get global Drush commandfiles that are managed by composer. In this case, there might be some very deep hierarchies that we'd rather not search.To work around this, this PR further restricts searching to inside a folder 'aliases', if it exists in any search location. If a folder named 'aliases' does not exist, then the entire search location is searched.
I suppose an alternate idea would be to deeply search $LOCATION/aliases, and also consider alias files contained directly inside $LOCATION. In this instance, though, the --alias-path location should probably always be searched recursively. This is slightly awkward vis-a-vis the current implementation of alias file searching, but not insurmountably so.