2 * Implements hook_requirements().
4 function {{ machine_name }}_requirements($phase) {
7 // Report Drupal version
8 if ($phase == 'runtime') {
9 $requirements['drupal'] = [
10 'title' => t('Drupal'),
11 'value' => \Drupal::VERSION,
12 'severity' => REQUIREMENT_INFO,
17 $requirements['php'] = [
19 'value' => ($phase == 'runtime') ? \Drupal::l(phpversion(), new Url('system.php')) : phpversion(),
21 if (version_compare(phpversion(), DRUPAL_MINIMUM_PHP) < 0) {
22 $requirements['php']['description'] = t('Your PHP installation is too old. Drupal requires at least PHP %version.', ['%version' => DRUPAL_MINIMUM_PHP]);
23 $requirements['php']['severity'] = REQUIREMENT_ERROR;
27 if ($phase == 'runtime') {
28 $cron_last = \Drupal::state()->get('system.cron_last');
30 if (is_numeric($cron_last)) {
31 $requirements['cron']['value'] = t('Last run @time ago', ['@time' => \Drupal::service('date.formatter')->formatTimeDiffSince($cron_last)]);
34 $requirements['cron'] = [
35 'description' => t('Cron has not run. It appears cron jobs have not been setup on your system. Check the help pages for <a href=":url">configuring cron jobs</a>.', [':url' => 'https://www.drupal.org/cron']),
36 'severity' => REQUIREMENT_ERROR,
37 'value' => t('Never run'),
41 $requirements['cron']['description'] .= ' ' . t('You can <a href=":cron">run cron manually</a>.', [':cron' => \Drupal::url('system.run_cron')]);
43 $requirements['cron']['title'] = t('Cron maintenance tasks');