如何理解hook_requirements中的'runtime'?

How to understand the 'runtime' in hook_requirements?

/docroot/modules/contrib/ultimate_cron/ultimate_cron.install

我在上面的路径中看到了一些代码段。而且我不明白这里'runtime'的意思。答案是网站 运行 的那一刻吗?或者每隔一段时间处理下面的代码?

/**
 * Implements hook_requirements().
 */
function ultimate_cron_requirements($phase) {
  $requirements = array();

  switch ($phase) {
    case 'runtime':
      $requirements['cron_jobs']['title'] = 'Ultimate Cron';
      $requirements['cron_jobs']['severity'] = REQUIREMENT_OK;

      // Check if any jobs are behind.
      $jobs_behind = 0;
      $jobs = CronJob::loadMultiple();

      foreach ($jobs as $job) {
        if ($job->isBehindSchedule()) {
          $jobs_behind++;
        }
      }

      if ($jobs_behind) {
        $requirements['cron_jobs']['severity'] = REQUIREMENT_WARNING;
        $requirements['cron_jobs']['value'] = \Drupal::translation()->formatPlural(
          $jobs_behind,
          '@count job is behind schedule',
          '@count jobs are behind schedule'
        );
        $requirements['cron_jobs']['description'] = [
          '#markup' => t('Some jobs are behind their schedule. Please check if <a href=":system_cron_url">Cron</a> is running properly.', [
            ':system_cron_url' => Url::fromRoute('system.cron', ['key' => \Drupal::state()->get('system.cron_key')])->toString()
          ])
        ];
      }
      else {
        $requirements['cron_jobs']['value'] = t('Cron is running properly.');
      }
  }

  return $requirements;
}

直接取自the docs。阅读它们以获取更多信息。

function hook_requirements

Check installation requirements and do status reporting.
This hook has three closely related uses, determined by the $phase argument:

  • Checking installation requirements ($phase == 'install').
  • Checking update requirements ($phase == 'update').
  • Status reporting ($phase == 'runtime').

The 'runtime' phase is not limited to pure installation requirements but can also be used for more general status information like maintenance tasks and security issues. The returned 'requirements' will be listed on the status report in the administration section, with indication of the severity level. Moreover, any requirement with a severity of REQUIREMENT_ERROR severity will result in a notice on the administration configuration page.

“运行时代码”($phase == 'runtime'的情况)将在您访问状态报告页面时执行(/admin/reports/status

参考文献:

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension%21module.api.php/function/hook_requirements/8.2.x