maintenanceMode = $maintenance_mode; $this->account = $account; } /** * Logout users if site is in maintenance mode and user is not exempt. * * @param \Symfony\Component\HttpKernel\Event\RequestEvent $event * The event to process. */ public function onMaintenanceModeRequest(RequestEvent $event) { // If the site is offline, log out unprivileged users. if ($this->account->isAuthenticated()) { user_logout(); } } /** * {@inheritdoc} */ public static function getSubscribedEvents(): array { $events[MaintenanceModeEvents::MAINTENANCE_MODE_REQUEST][] = [ 'onMaintenanceModeRequest', -900, ]; return $events; } }