You are here

function ultimate_cron_requirements in Ultimate Cron 7

Same name and namespace in other branches
  1. 8.2 ultimate_cron.install \ultimate_cron_requirements()
  2. 8 ultimate_cron.install \ultimate_cron_requirements()
  3. 6 ultimate_cron.install \ultimate_cron_requirements()
  4. 7.2 ultimate_cron.install \ultimate_cron_requirements()

Implements hook_requirements().

1 call to ultimate_cron_requirements()
ultimate_cron_view_page in ./ultimate_cron.admin.inc
Page overviewing cron jobs.

File

./ultimate_cron.install, line 152
Installation file for Ultimate Cron

Code

function ultimate_cron_requirements($phase) {
  $response = array();
  switch ($phase) {
    case 'install':
      return $response;
    case 'runtime':
      $t = get_t();
      $response['title'] = 'Ultimate Cron';
      $response['value'] = $t('OK');
      $response['severity'] = REQUIREMENT_OK;
      if ($modules = _ultimate_cron_incompatible_modules()) {
        $response['severity'] = REQUIREMENT_ERROR;
        $response['value'] = $t('Ultimate Cron is DISABLED!');
        $response['description'] = $t('%modules is installed on the system, but is incompatible with Ultimate Cron.<br/>Please disable the modules %modules.<br/>You might want to !url settings first.', array(
          '%modules' => join(', ', $modules),
          '!url' => l(t('import'), 'admin/settings/cron/import'),
        ));
      }
      if (ini_get('safe_mode')) {
        $desc = $t('Safe mode enabled. Ultimate Cron is unable to control maximum execution time for cron jobs. This may cause cron jobs to end prematurely.');
        if ($response['severity'] < REQUIREMENT_WARNING) {
          $response['severity'] = REQUIREMENT_WARNING;
          $response['value'] = $t('Safe mode enabled');
          $response['description'] = $desc;
        }
        else {
          $response['description'] .= '<br/>' . $desc;
        }
      }
      $result = array();
      $result['ultimate_cron'] = $response;
      return $result;
  }
}