You are here

function update_status_calculate_project_data in Update Status 5

Same name and namespace in other branches
  1. 5.2 update_status.module \update_status_calculate_project_data()
2 calls to update_status_calculate_project_data()
update_status_requirements in ./update_status.module
Implementation of hook_requirements
update_status_status in ./update_status.module
Menu callback. Generate a page of information about the update status of projects.

File

./update_status.module, line 61

Code

function update_status_calculate_project_data($info) {
  $data = update_status_get_projects();
  $settings = variable_get('update_status_settings', array());
  foreach (array_keys($data) as $project) {
    if (array_key_exists($project, $info)) {

      // The name is returned in human-readable format. Change it to title
      // so it's not overwritten by the name key returned by update_status_get_projects().
      $info[$project]['title'] = $info[$project]['name'];
      $data[$project] += $info[$project];
      if (isset($settings[$project]) && isset($settings[$project]['check']) && ($settings[$project]['check'] == 'never' || $settings[$project]['check'] == $info[$project]['version'])) {
        $data[$project]['check'] = FALSE;
        $data[$project]['status'] = UPDATE_STATUS_NOT_CHECKED;
      }
      else {
        if (isset($data[$project]['check']) && empty($data[$project]['check'])) {
          $data[$project]['status'] = UPDATE_STATUS_CANT_CHECK;
        }
        else {
          $data[$project]['status'] = $data[$project]['existing_version'] == $data[$project]['version'] ? UPDATE_STATUS_CURRENT : UPDATE_STATUS_NOT_CURRENT;
        }
      }
    }
    else {
      $data[$project]['status'] = UPDATE_STATUS_UNKNOWN;
    }
  }
  return $data;
}