Skip to content

Commit

Permalink
ACMS-1890: Refactor overall code.
Browse files Browse the repository at this point in the history
  • Loading branch information
chandan-singh7929 committed Nov 22, 2023
1 parent 0bf1bc3 commit 26e80fc
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/Robo/Commands/Source/SettingsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Acquia\Blt\Robo\Common\RandomString;
use Acquia\Blt\Robo\Config\ConfigInitializer;
use Acquia\Blt\Robo\Exceptions\BltException;
use Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException;
use Acquia\Drupal\RecommendedSettings\Settings;
use Robo\Contract\VerbosityThresholdInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -48,21 +49,25 @@ public function generateSiteConfigFiles() {
$current_site = $multisite;

// Get db spec of current site.
$dbSpec = $this->getConfig()->get('drupal.db');
if ($dbSpec) {
$dbSpec = ['drupal' => ['db' => $dbSpec]];
$db_spec = $this->getConfig()->get('drupal.db');
if ($db_spec) {
$db_spec = [
'drupal' => [
'db' => $db_spec
]
];
}

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

// Use settings file from DRS.
$drupalRecommendedSettings = new Settings($this->getConfigValue('docroot'), $multisite);
$drupalRecommendedSettings->generate();

// Generate local.drush.yml.
$blt_local_drush_file = $this->getConfigValue('blt.root') . '/settings/default.local.drush.yml';
$default_local_drush_file = "$multisite_dir/default.local.drush.yml";
Expand Down

0 comments on commit 26e80fc

Please sign in to comment.