Skip to content
Snippets Groups Projects
Commit f101c6e2 authored by Theresa Grannum's avatar Theresa Grannum Committed by Ted Bowman
Browse files

Issue #3277817 by Theresa.Grannum, mherman-pro: Before applying the update,...

Issue #3277817 by Theresa.Grannum, mherman-pro: Before applying the update, don't show the checkbox for maintenance mode if the site is already in maintenance mode
parent 95bdbbe9
No related branches found
No related tags found
1 merge request!320Issue #3277817: Before applying the update, don't show the checkbox for maintenance mode if the site is already in maintenance mode
......@@ -165,11 +165,14 @@ class UpdateReady extends FormBase {
'#markup' => $this->t('Back up your database and site before you continue. <a href=":backup_url">Learn how</a>.', [':backup_url' => 'https://www.drupal.org/node/22281']),
'#suffix' => '</strong>',
];
$form['maintenance_mode'] = [
'#title' => $this->t('Perform updates with site in maintenance mode (strongly recommended)'),
'#type' => 'checkbox',
'#default_value' => TRUE,
];
if (!$this->state->get('system.maintenance_mode')) {
$form['maintenance_mode'] = [
'#title' => $this->t('Perform updates with site in maintenance mode (strongly recommended)'),
'#type' => 'checkbox',
'#default_value' => TRUE,
];
}
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Continue'),
......@@ -204,6 +207,7 @@ class UpdateReady extends FormBase {
if ($form_state->getValue('maintenance_mode')) {
$this->state->set('system.maintenance_mode', TRUE);
}
$stage_id = $form_state->getValue('stage_id');
$batch = (new BatchBuilder())
->setTitle($this->t('Apply updates'))
......
......@@ -413,7 +413,12 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$possible_update_message = 'Possible database updates were detected in the following modules; you may be redirected to the database update page in order to complete the update process.';
$assert_session->pageTextContains($possible_update_message);
$assert_session->pageTextContains('System');
$assert_session->checkboxChecked('maintenance_mode');
if ($maintenance_mode_on === TRUE) {
$assert_session->fieldNotExists('maintenance_mode');
}
else {
$assert_session->checkboxChecked('maintenance_mode');
}
$assert_session->pageTextNotContains($cached_message);
$page->pressButton('Continue');
$this->checkForMetaRefresh();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment