You are here

public function DefaultController::wardenStatus in Warden 8

Same name and namespace in other branches
  1. 8.2 src/Controller/DefaultController.php \Drupal\warden\Controller\DefaultController::wardenStatus()
  2. 3.x src/Controller/DefaultController.php \Drupal\warden\Controller\DefaultController::wardenStatus()

Routing callback to retrieve the data stored on the site.

Return value

JsonResponse

1 string reference to 'DefaultController::wardenStatus'
warden.routing.yml in ./warden.routing.yml
warden.routing.yml

File

src/Controller/DefaultController.php, line 172

Class

DefaultController
Default controller for the warden module.

Namespace

Drupal\warden\Controller

Code

public function wardenStatus() {
  \Drupal::service('page_cache_kill_switch')
    ->trigger();
  $response = new JsonResponse();
  try {
    $this
      ->getWardenManager()
      ->updateWarden();
    $response
      ->setData([
      'data' => 'OK',
    ]);
  } catch (\Exception $e) {
    watchdog_exception('warden', $e);
    $response
      ->setStatusCode(500);
    $response
      ->setData([
      'error' => 'Internal fault',
    ]);
  }
  return $response;
}