You are here

public function MaintenanceModeSubscriber::onKernelRequestMaintenance in Nagios Monitoring 8

Make the status page available when Drupal is in maintenance mode.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseEvent $event: The event to process.

File

src/EventSubscriber/MaintenanceModeSubscriber.php, line 18

Class

MaintenanceModeSubscriber

Namespace

Drupal\nagios\EventSubscriber

Code

public function onKernelRequestMaintenance(GetResponseEvent $event) {
  $config = \Drupal::config('nagios.settings');
  $request = $event
    ->getRequest();
  $nagios_path = '/' . $config
    ->get('nagios.statuspage.path');
  if ($request
    ->getPathInfo() === $nagios_path) {
    $oController = new StatuspageController();
    if ($oController
      ->access()
      ->isAllowed()) {
      $event
        ->setResponse($oController
        ->content());
    }
  }
}