3 namespace Drupal\Core\Site;
5 use Drupal\Core\Routing\RouteMatchInterface;
6 use Drupal\Core\Session\AccountInterface;
7 use Drupal\Core\State\StateInterface;
10 * Provides the default implementation of the maintenance mode service.
12 class MaintenanceMode implements MaintenanceModeInterface {
17 * @var \Drupal\Core\State\StateInterface
22 * Constructs a new maintenance mode service.
24 * @param \Drupal\Core\State\StateInterface $state
27 public function __construct(StateInterface $state) {
28 $this->state = $state;
34 public function applies(RouteMatchInterface $route_match) {
35 if (!$this->state->get('system.maintenance_mode')) {
39 if ($route = $route_match->getRouteObject()) {
40 if ($route->getOption('_maintenance_access')) {
51 public function exempt(AccountInterface $account) {
52 return $account->hasPermission('access site in maintenance mode');