Mercurial > hg > isophonics-drupal-site
view core/lib/Drupal/Core/Site/MaintenanceMode.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line source
<?php namespace Drupal\Core\Site; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\State\StateInterface; /** * Provides the default implementation of the maintenance mode service. */ class MaintenanceMode implements MaintenanceModeInterface { /** * The state. * * @var \Drupal\Core\State\StateInterface */ protected $state; /** * Constructs a new maintenance mode service. * * @param \Drupal\Core\State\StateInterface $state * The state. */ public function __construct(StateInterface $state) { $this->state = $state; } /** * {@inheritdoc} */ public function applies(RouteMatchInterface $route_match) { if (!$this->state->get('system.maintenance_mode')) { return FALSE; } if ($route = $route_match->getRouteObject()) { if ($route->getOption('_maintenance_access')) { return FALSE; } } return TRUE; } /** * {@inheritdoc} */ public function exempt(AccountInterface $account) { return $account->hasPermission('access site in maintenance mode'); } }