You are here

function upgrade_status_get_available in Upgrade Status 6

Same name and namespace in other branches
  1. 5 upgrade_status.admin.inc \upgrade_status_get_available()
  2. 7 upgrade_status.module \upgrade_status_get_available()

Internal helper to try to get the update information from the cache if possible, and to refresh the cache when necessary.

In addition to checking the cache lifetime, this function also ensures that there are no .info files for enabled modules or themes that have a newer modification timestamp than the last time we checked for available update data. If any .info file was modified, it almost certainly means a new version of something was installed. Without fresh available update data, the logic in update_calculate_project_data() will be wrong and produce confusing, bogus results.

Parameters

$refresh: Boolean to indicate if this method should refresh the cache automatically if there's no data.

See also

update_refresh()

update_get_projects()

1 call to upgrade_status_get_available()
upgrade_status_status in ./upgrade_status.report.inc
Menu callback. Generate a page about the upgrade status of projects.

File

./upgrade_status.module, line 95
Checks to see if your installed modules are available for the next major release of Drupal.

Code

function upgrade_status_get_available($refresh = FALSE) {
  module_load_include('inc', 'upgrade_status', 'upgrade_status.compare');
  $available = array();
  if (!$refresh && ($cache = _update_cache_get('upgrade_status_available_releases')) && $cache->expire > time()) {
    $available = $cache->data;
  }
  else {
    $available = upgrade_status_refresh();
  }
  return $available;
}