You are here

function update_status_requirements in Update Status 5

Same name and namespace in other branches
  1. 5.2 update_status.module \update_status_requirements()

Implementation of hook_requirements

1 call to update_status_requirements()
update_status_help in ./update_status.module
Implementation of hook_help().

File

./update_status.module, line 419

Code

function update_status_requirements($phase) {
  if ($phase == 'runtime') {
    $requirements['update_status']['title'] = t('Module update status');
    $requirements['update_status_drupal']['title'] = t('Drupal core update status');
    if ($info = variable_get('update_status', FALSE)) {
      $data = update_status_calculate_project_data($info);
      if ($data['drupal']['status'] == UPDATE_STATUS_NOT_CURRENT) {
        $requirements['update_status_drupal']['value'] = t('Out of date. Version @version available.', array(
          '@version' => $info['drupal']['version'],
        ));
        $requirements['update_status_drupal']['severity'] = REQUIREMENT_ERROR;
        $requirements['update_status_drupal']['description'] = t('There are updates available for your version of Drupal. To ensure the security of your server, you should update immediately.See the !status_page for more information', array(
          '!status_page' => l('update status page', 'admin/logs/updates'),
        ));
      }
      else {
        $requirements['update_status_drupal']['value'] = t('Up to date');
      }

      // We don't want to check drupal a second time.
      unset($data['drupal']);
      $requirements['update_status']['value'] = t('Up to date');
      foreach (array_keys($data) as $project) {
        if (array_key_exists($project, $info) && $data[$project]['status'] == UPDATE_STATUS_NOT_CURRENT) {
          $requirements['update_status']['value'] = t('Out of date');
          $requirements['update_status']['severity'] = REQUIREMENT_ERROR;
          $requirements['update_status']['description'] = t('There are updates available for one or more of your modules. To ensure the security of your server, you should update immediately. See the !status_page for more information', array(
            '!status_page' => l('update status page', 'admin/logs/updates'),
          ));
          break;
        }
      }
    }
    else {
      $requirements['update_status']['value'] = t('Update status is unavailable. cron may need to be run.');
      $requirements['update_status_drupal']['value'] = t('Update status is unavailable. cron may need to be run.');
    }
    return $requirements;
  }
}