function MaintenanceModeSubscriber::onMaintenanceModeRequest
Same name in this branch
- 10 core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::onMaintenanceModeRequest()
Same name in other branches
- 9 core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php \Drupal\user\EventSubscriber\MaintenanceModeSubscriber::onMaintenanceModeRequest()
- 9 core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::onMaintenanceModeRequest()
- 11.x core/modules/user/src/EventSubscriber/MaintenanceModeSubscriber.php \Drupal\user\EventSubscriber\MaintenanceModeSubscriber::onMaintenanceModeRequest()
- 11.x core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber::onMaintenanceModeRequest()
Logout users if site is in maintenance mode and user is not exempt.
Parameters
\Symfony\Component\HttpKernel\Event\RequestEvent $event: The event to process.
File
-
core/
modules/ user/ src/ EventSubscriber/ MaintenanceModeSubscriber.php, line 49
Class
- MaintenanceModeSubscriber
- Maintenance mode subscriber to log out users.
Namespace
Drupal\user\EventSubscriberCode
public function onMaintenanceModeRequest(RequestEvent $event) {
// If the site is offline, log out unprivileged users.
if ($this->account
->isAuthenticated()) {
user_logout();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.