Skip to content

Commit

Permalink
OPENEUROPA-1149: Improve force option processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
D Vargas committed Sep 28, 2018
1 parent 294c43c commit ce545cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ drupal:
sites_subdir: "default"
config_dir: ~
settings_override_file: "settings.override.php"
force: true

# Administrator account information.
account:
Expand Down
5 changes: 3 additions & 2 deletions src/Commands/DrupalCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ public function drushSetup(array $options = [
* @option root Drupal root.
* @option sites-subdir Drupal site subdirectory.
* @option settings-override-file Drupal site settings override filename.
* @option force Drupal force site settings override.
*
* @param array $options
*
Expand All @@ -289,15 +290,15 @@ public function settingsSetup(array $options = [
'root' => InputOption::VALUE_REQUIRED,
'sites-subdir' => InputOption::VALUE_REQUIRED,
'settings-override-file' => InputOption::VALUE_REQUIRED,
'force' => false,
'force' => InputOption::VALUE_REQUIRED,
])
{
$settings_default_path = $options['root'] . '/sites/' . $options['sites-subdir'] . '/default.settings.php';
$settings_path = $options['root'] . '/sites/' . $options['sites-subdir'] . '/settings.php';
$settings_override_path = $options['root'] . '/sites/' . $options['sites-subdir'] . '/' . $options['settings-override-file'];

return $this->collectionBuilder()->addTaskList([
$this->taskFilesystemStack()->copy($settings_default_path, $settings_path, ($options['force'] === true) ? $options['force'] : false),
$this->taskFilesystemStack()->copy($settings_default_path, $settings_path, (bool) $options['force']),
$this->taskWriteToFile($settings_path)->append()->lines([
"if (file_exists(\$app_root . '/' . \$site_path . '/" . $options['settings-override-file'] . "')) {",
" include \$app_root . '/' . \$site_path . '/" . $options['settings-override-file'] . "';",
Expand Down

0 comments on commit ce545cc

Please sign in to comment.