Commit 5f80c8ec authored by webchick's avatar webchick

Issue #2453351 by effulgentsia, Wim Leers: Maintenance mode message ends up in...

Issue #2453351 by effulgentsia, Wim Leers: Maintenance mode message ends up in page cache, served endlessly
parent f07bcffa
......@@ -98,6 +98,8 @@ public function __construct(MaintenanceModeInterface $maintenance_mode, ConfigFa
public function onKernelRequestMaintenance(GetResponseEvent $event) {
$route_match = RouteMatch::createFromRequest($event->getRequest());
if ($this->maintenanceMode->applies($route_match)) {
// Don't cache maintenance mode pages.
\Drupal::service('page_cache_kill_switch')->trigger();
if (!$this->maintenanceMode->exempt($this->account)) {
// Deliver the 503 page if the site is in maintenance mode and the
// logged in user is not allowed to bypass it.
......
......@@ -38,10 +38,31 @@ protected function setUp() {
$this->drupalLogin($this->admin_user);
}
/**
* Verify site maintenance mode functionality with page cache disabled.
*/
function testSiteMaintenanceWithoutPageCache() {
$config = $this->config('system.performance');
$config->set('cache.page.use_internal', 0);
$config->save();
$this->doTestSiteMaintenance();
}
/**
* Verify site maintenance mode functionality with page cache enabled.
*/
function testSiteMaintenanceWithPageCache() {
$config = $this->config('system.performance');
$config->set('cache.page.use_internal', 1);
$config->set('cache.page.max_age', 300);
$config->save();
$this->doTestSiteMaintenance();
}
/**
* Verify site maintenance mode functionality.
*/
function testSiteMaintenance() {
protected function doTestSiteMaintenance() {
// Turn on maintenance mode.
$edit = array(
'maintenance_mode' => 1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment