Skip to content

Commit

Permalink
EWPP-1165: Reorganise code for adapting drush site-install arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
sergepavle committed Oct 26, 2021
1 parent f6007bd commit 7ac6db6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
10 changes: 4 additions & 6 deletions config/runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ drupal:
# Setting this to "false" will run "site-install" without the "--db-url" parameter.
# This is useful if the database settings are already set in your settings.php file.
generate_db_url: true
# By setting this to FALSE, will disable the update status module option
# (install_configure_form.enable_update_status_module) during "site-install" execution. By default, is TRUE.
update_status_module: "true"
# By setting this to FALSE, will disable the update status emails option
# (install_configure_form.enable_update_status_emails) during "site-install" execution. By default, is TRUE.
update_status_emails: "true"
# Setting this to "false" will tell the "site-install" command to not enable the update status module.
update_status_module: true
# Setting this to "false" will tell the "site-install" command to disable email notifications about updates.
update_status_emails: true

# Administrator account information.
account:
Expand Down
10 changes: 5 additions & 5 deletions src/Commands/AbstractDrupalCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ public function siteInstall(array $options = [
$options['existing-config'] = true;
}

// Adapt values for the installation configuration form parameters.
$options['enable-update-status-module'] = filter_var($options['enable-update-status-module'], FILTER_VALIDATE_BOOLEAN) === false ? 'NULL' : $options['enable-update-status-module'];
$options['enable-update-status-emails'] = filter_var($options['enable-update-status-emails'], FILTER_VALIDATE_BOOLEAN) === false ? 'NULL' : $options['enable-update-status-emails'];
// Pass value as boolean type only.
$options['enable-update-status-module'] = filter_var($options['enable-update-status-module'], FILTER_VALIDATE_BOOLEAN);
$options['enable-update-status-emails'] = filter_var($options['enable-update-status-emails'], FILTER_VALIDATE_BOOLEAN);

$drush = $this->getConfig()->get('runner.bin_dir') . '/drush';
$task = $this->taskDrush($drush)
Expand All @@ -199,8 +199,8 @@ public function siteInstall(array $options = [
->databaseName($options['database-name'])
->sitesSubdir($options['sites-subdir'])
->siteProfile($options['site-profile'])
->setUpdateStatusModule($options['enable-update-status-module'])
->setUpdateStatusEmails($options['enable-update-status-emails']);
->setEnableStatusModuleOnInstall($options['enable-update-status-module'])
->setEnableUpdateStatusEmails($options['enable-update-status-emails']);

$task->setGenerateDbUrl($this->getConfig()->get('drupal.site.generate_db_url'));

Expand Down
17 changes: 9 additions & 8 deletions src/Tasks/Drush/Drush.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ public function siteInstall()

return $this->arg('site-install')
->arg($this->siteProfile)
->rawArg("install_configure_form.enable_update_status_module=" . $this->updateStatusModule)
->rawArg("install_configure_form.enable_update_status_emails=" . $this->updateStatusEmails);
// Adapt values for the installation configuration form parameters.
->rawArg('install_configure_form.enable_update_status_module=' . ($this->updateStatusModule ? 'true' : 'NULL'))
->rawArg('install_configure_form.enable_update_status_emails=' . ($this->updateStatusEmails ? 'true' : 'NULL'));
}

/**
Expand Down Expand Up @@ -294,25 +295,25 @@ public function setGenerateDbUrl($generateDbUrl)
}

/**
* @param bool $updateStatusModule
* @param bool $enable
*
* @return Drush
*/
public function setUpdateStatusModule($updateStatusModule)
public function setEnableStatusModuleOnInstall($enable)
{
$this->updateStatusModule = $updateStatusModule;
$this->updateStatusModule = $enable;

return $this;
}

/**
* @param bool $updateStatusEmails
* @param bool $enable
*
* @return Drush
*/
public function setUpdateStatusEmails($updateStatusEmails)
public function setEnableUpdateStatusEmails($enable)
{
$this->updateStatusEmails = $updateStatusEmails;
$this->updateStatusEmails = $enable;

return $this;
}
Expand Down

0 comments on commit 7ac6db6

Please sign in to comment.