Skip to content
Snippets Groups Projects
Commit 421901f7 authored by Ted Bowman's avatar Ted Bowman
Browse files

Issue #3266633 by tedbow: We don't currently actually set maintenance mode

parent fae8fb79
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,8 @@ automatic_updates.update_readiness:
_title: 'Update readiness checking'
requirements:
_permission: 'administer software updates'
options:
_maintenance_access: TRUE
automatic_updates.confirmation_page:
path: '/admin/automatic-update-ready/{stage_id}'
defaults:
......@@ -13,12 +15,16 @@ automatic_updates.confirmation_page:
requirements:
_permission: 'administer software updates'
_access_update_manager: 'TRUE'
options:
_maintenance_access: TRUE
automatic_updates.finish:
path: '/automatic-update/finish'
defaults:
_controller: '\Drupal\automatic_updates\Controller\UpdateController::onFinish'
requirements:
_permission: 'administer software updates'
options:
_maintenance_access: TRUE
# Links to our updater form appear in three different sets of local tasks. To ensure the breadcrumbs and paths are
# consistent with the other local tasks in each set, we need two separate routes to the same form.
automatic_updates.report_update:
......@@ -30,6 +36,7 @@ automatic_updates.report_update:
_permission: 'administer software updates'
options:
_admin_route: TRUE
_maintenance_access: TRUE
automatic_updates.module_update:
path: '/admin/modules/automatic-update'
defaults:
......@@ -39,6 +46,7 @@ automatic_updates.module_update:
_permission: 'administer software updates'
options:
_admin_route: TRUE
_maintenance_access: TRUE
automatic_updates.theme_update:
path: '/admin/theme/automatic-update'
defaults:
......@@ -48,3 +56,4 @@ automatic_updates.theme_update:
_permission: 'administer software updates'
options:
_admin_route: TRUE
_maintenance_access: TRUE
......@@ -174,7 +174,7 @@ class UpdateReady extends FormBase {
$session = $this->getRequest()->getSession();
// Store maintenance_mode setting so we can restore it when done.
$session->set('maintenance_mode', $this->state->get('system.maintenance_mode'));
if ($form_state->getValue('maintenance_mode') === TRUE) {
if ($form_state->getValue('maintenance_mode')) {
$this->state->set('system.maintenance_mode', TRUE);
// @todo unset after updater. After db update?
}
......
......@@ -5,9 +5,13 @@ automatic_updates_test.metadata:
_controller: '\Drupal\automatic_updates_test\TestController::metadata'
requirements:
_access: 'TRUE'
options:
_maintenance_access: TRUE
automatic_updates_test.update:
path: '/automatic-update-test/update/{to_version}'
defaults:
_controller: '\Drupal\automatic_updates_test\TestController::update'
requirements:
_access: 'TRUE'
options:
_maintenance_access: TRUE
......@@ -64,6 +64,7 @@ class ReadinessValidationTest extends AutomaticUpdatesFunctionalTestBase {
'administer site configuration',
'administer software updates',
'access administration pages',
'access site in maintenance mode',
]);
$this->createTestValidationResults();
$this->drupalLogin($this->reportViewerUser);
......
......@@ -401,10 +401,16 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1);
$this->assertUpdateReady();
$this->assertNotTrue($this->container->get('state')->get('system.maintenance_mode'));
$page->pressButton('Continue');
$this->checkForMetaRefresh();
$assert_session = $this->assertSession();
$assert_session->addressEquals('/admin/reports/updates');
// Assert that the site was put into maintenance mode.
// @todo Add test coverage to ensure that site is taken back out of
// maintenance if it was not originally in maintenance mode when the
// update started in https://www.drupal.org/i/3265057.
$this->assertTrue($this->container->get('state')->get('system.maintenance_mode'));
$assert_session->pageTextContainsOnce('Update complete!');
}
......
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