Skip to content

Commit

Permalink
ACMS-1890: Update Settings command to run drush command to generate s…
Browse files Browse the repository at this point in the history
…ettings.
  • Loading branch information
vishalkhode1 committed Mar 27, 2024
1 parent f79c28b commit c6465a8
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/Robo/Commands/Source/SettingsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
use Acquia\Blt\Robo\Common\RandomString;
use Acquia\Blt\Robo\Config\ConfigInitializer;
use Acquia\Blt\Robo\Exceptions\BltException;
use Acquia\Drupal\RecommendedSettings\Drush\Commands\SettingsDrushCommands;
use Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException;
use Acquia\Drupal\RecommendedSettings\Settings;
use Robo\Contract\VerbosityThresholdInterface;
use Robo\ResultData;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Filesystem\Filesystem;

Expand Down Expand Up @@ -48,23 +50,14 @@ public function generateSiteConfigFiles() {
$this->switchSiteContext($multisite);
$current_site = $multisite;

// Get db spec of current site.
$db_spec = $this->getConfig()->get('drupal.db');
if ($db_spec) {
$db_spec = [
'drupal' => [
'db' => $db_spec
]
];
$result = $this->taskDrush()
->drush(SettingsDrushCommands::SETTINGS_COMMAND)
->uri($multisite)
->run();
if ($result->getExitCode() == ResultData::EXITCODE_ERROR) {
$this->io->error($result->getMessage());
}

// Generate settings file using DRS for current site.
$drupalRecommendedSettings = new Settings($this->getConfigValue('docroot'), $current_site);
try {
$drupalRecommendedSettings->generate($db_spec);
} catch (SettingsException $e) {
$this->logger->warning($e->getMessage());
}
}
$multisite_dir = $this->getConfigValue('docroot') . "/sites/$multisite";

Expand Down

0 comments on commit c6465a8

Please sign in to comment.