Skip to content

Commit

Permalink
9.4.23
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish authored Jun 21, 2023
2 parents 48a44ba + 4921a93 commit 59a0551
Show file tree
Hide file tree
Showing 28 changed files with 496 additions and 304 deletions.
20 changes: 3 additions & 17 deletions blt/src/Blt/Plugin/Commands/ToggleModulesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

namespace Humsci\Blt\Plugin\Commands;

use Acquia\Blt\Robo\Blt;
use Acquia\Blt\Robo\BltTasks;
use Acquia\Blt\Robo\Common\UserConfig;
use Acquia\Blt\Robo\Exceptions\BltException;
use Zumba\Amplitude\Amplitude;

/**
* Defines commands in the "drupal:toggle:modules" namespace.
Expand Down Expand Up @@ -57,30 +54,19 @@ public function toggleModules() {
* @throws \Acquia\Blt\Robo\Exceptions\BltException
*/
protected function doToggleModules($command, $config_key) {
$userConfig = new UserConfig(Blt::configDir());
$eventInfo = $userConfig->getTelemetryUserData();

if ($this->getConfig()->has($config_key)) {
$this->say("Executing <comment>drush $command</comment> for modules defined in <comment>$config_key</comment>...");
$modules = (array) $this->getConfigValue($config_key);
$modules_list = implode(' ', $modules);
$result = $this->taskDrush()
->drush("$command $modules_list")
->run();
$exit_code = $result->getExitCode();
$eventInfo['active'] = TRUE;
$eventInfo['modules'] = md5($modules_list);
Amplitude::getInstance()->queueEvent('toggle-modules', $eventInfo);
if (!$result->wasSuccessful()) {
throw new BltException("Could not toggle modules listed in $config_key.");
}
}
else {
$exit_code = 0;
$this->logger->info("$config_key is not set.");
$eventInfo['active'] = FALSE;
Amplitude::getInstance()->queueEvent('toggle-modules', $eventInfo);
}

if ($exit_code) {
throw new BltException("Could not toggle modules listed in $config_key.");
}
}

Expand Down
Loading

0 comments on commit 59a0551

Please sign in to comment.