use Drush\Config\Loader\YamlConfigLoader;
use Consolidation\Config\Loader\ConfigProcessor;
use Consolidation\Config\Util\EnvConfig;
-use Symfony\Component\Finder\Finder;
/**
* Locate Drush configuration files and load them into the configuration
// Make all of the config values parsed so far available in evaluations.
$reference = $this->config()->export();
$processor = new ConfigProcessor();
+ $processor->useMergeStrategyForKeys(['drush.paths.include', 'drush.paths.alias-path']);
$context = $this->config->getContext($contextName);
$processor->add($context->export());
{
$builtin = $this->getBuiltinCommandFilePaths();
$included = $this->getIncludedCommandFilePaths($commandPaths);
- $site = $this->getSiteCommandFilePaths(["$root/drush", dirname($root) . '/drush']);
+ $site = $this->getSiteCommandFilePaths($root);
return array_merge(
$builtin,
* 'dirname($root)/drush' directory that contains a composer.json
* file or a 'Commands' or 'src/Commands' directory.
*/
- protected function getSiteCommandFilePaths($directories)
+ protected function getSiteCommandFilePaths($root)
{
- $result = [];
-
- $directories = array_filter($directories, 'is_dir');
-
- if (empty($directories)) {
- return $result;
- }
+ $directories = ["$root/drush", dirname($root) . '/drush', "$root/sites/all/drush"];
- // Find projects
- $finder = new Finder();
- $finder->files()
- ->ignoreUnreadableDirs()
- ->path('#composer.json$|^src/Commands|^Commands#')
- ->in($directories)
- ->depth('<= 3');
-
- foreach ($finder as $file) {
- $result[] = dirname($file->getRealPath());
- }
-
- return $result;
+ return array_filter($directories, 'is_dir');
}
/**