Access check for cron routes.
Expanded class hierarchy of CronAccessCheck
class CronAccessCheck implements AccessCheckInterface {
/**
* Implements AccessCheckInterface::applies().
*/
public function applies(Route $route) {
return array_key_exists('_access_system_cron', $route
->getRequirements());
}
/**
* Implements AccessCheckInterface::access().
*/
public function access(Route $route, Request $request) {
$key = $request->attributes
->get('key');
if ($key != \Drupal::state()
->get('system.cron_key')) {
watchdog('cron', 'Cron could not run because an invalid key was used.', array(), WATCHDOG_NOTICE);
return FALSE;
}
elseif (config('system.maintenance')
->get('enabled')) {
watchdog('cron', 'Cron could not run because the site is in maintenance mode.', array(), WATCHDOG_NOTICE);
return FALSE;
}
return TRUE;
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AccessCheckInterface:: |
constant | Grant access. | ||
AccessCheckInterface:: |
constant | Deny access. | ||
AccessCheckInterface:: |
constant | Block access. | ||
CronAccessCheck:: |
public | function |
Implements AccessCheckInterface::access(). Overrides AccessCheckInterface:: |
|
CronAccessCheck:: |
public | function |
Implements AccessCheckInterface::applies(). Overrides AccessCheckInterface:: |