Skip to content

Commit

Permalink
added commands to disable and enable modules
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Feb 20, 2019
1 parent 733e83a commit 39fedf9
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
70 changes: 70 additions & 0 deletions blt/src/Commands/HumsciCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
1 change: 0 additions & 1 deletion blt/src/Commands/HumsciServerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ public function humsciLetsEncryptGet($environment = 'dev') {
->alias($this->getConfigValue('drush.aliases.remote'))
->drush('eval')
->arg($php_command)
->printOutput(FALSE)
->run();
}

Expand Down

0 comments on commit 39fedf9

Please sign in to comment.