diff --git a/blt/src/Commands/HumsciCommand.php b/blt/src/Commands/HumsciCommand.php index 8eec9eb3bc..c0db96709a 100644 --- a/blt/src/Commands/HumsciCommand.php +++ b/blt/src/Commands/HumsciCommand.php @@ -12,6 +12,76 @@ class HumsciCommand extends AcHooksCommand { use HumsciTrait; + /** + * Disables a list of modules for all sites in an environment. + * + * @param string $modules + * Comma delimited list of modules to disable. + * @param string $environment + * Environment to disable modules. + * @param string $excluded_sites + * Comma delimited list of sites to skip. + * + * @command drupal:module:uninstall + */ + public function disableModules($modules, $environment, $excluded_sites = '') { + if (is_string($modules)) { + $modules = explode(',', $modules); + array_walk($modules, 'trim'); + } + if (is_string($excluded_sites)) { + $excluded_sites = explode(',', $excluded_sites); + array_walk($excluded_sites, 'trim'); + } + foreach ($this->getConfigValue('multisites') as $multisite) { + if (in_array($multisite, $excluded_sites)) { + continue; + } + $this->taskDrush() + ->alias("$multisite.$environment") + ->drush('pmu') + ->args(implode(',', $modules)) + ->drush('cr') + ->run(); + } + } + + /** + * Enables a list of modules for all sites in an environment. + * + * @param string $modules + * Comma delimited list of modules to enable. + * @param string $environment + * Environment to disable modules. + * @param string $excluded_sites + * Comma delimited list of sites to skip. + * + * @command drupal:module:enable + */ + public function enableModules($modules, $environment, $excluded_sites = '') { + if (is_string($modules)) { + $modules = explode(',', $modules); + array_walk($modules, 'trim'); + } + if (is_string($excluded_sites)) { + $excluded_sites = explode(',', $excluded_sites); + array_walk($excluded_sites, 'trim'); + } + foreach ($this->getConfigValue('multisites') as $multisite) { + if (in_array($multisite, $excluded_sites)) { + continue; + } + $this->taskDrush() + ->alias("$multisite.$environment") + ->drush('en') + ->args(implode(',', $modules)) + ->drush('cr') + ->drush('cim') + ->option('partial') + ->run(); + } + } + /** * Run cron on all sites. * diff --git a/blt/src/Commands/HumsciServerCommand.php b/blt/src/Commands/HumsciServerCommand.php index a510b006dd..f2159de700 100644 --- a/blt/src/Commands/HumsciServerCommand.php +++ b/blt/src/Commands/HumsciServerCommand.php @@ -277,7 +277,6 @@ public function humsciLetsEncryptGet($environment = 'dev') { ->alias($this->getConfigValue('drush.aliases.remote')) ->drush('eval') ->arg($php_command) - ->printOutput(FALSE) ->run(); }