You are here

function _upgrade_status_refresh in Upgrade Status 7

Same name and namespace in other branches
  1. 6 upgrade_status.fetch.inc \_upgrade_status_refresh()

Clears out all the cached available update data and initiates re-fetching.

2 calls to _upgrade_status_refresh()
upgrade_status_manual_status in ./upgrade_status.fetch.inc
Page callback: Checks for updates and displays the update status report.
upgrade_status_refresh in ./upgrade_status.module
Refreshes the release data after loading the necessary include file.

File

./upgrade_status.fetch.inc, line 175

Code

function _upgrade_status_refresh() {
  module_load_include('inc', 'upgrade_status', 'upgrade_status.compare');

  // Since we're fetching new available update data, we want to clear
  // our cache of both the projects we care about, and the current update
  // status of the site. We do *not* want to clear the cache of available
  // releases just yet, since that data (even if it's stale) can be useful
  // during update_get_projects(); for example, to modules that implement
  // hook_system_info_alter() such as cvs_deploy.
  // @todo: File upstream issue: cvs_deploy is irrelevant. :P
  _update_cache_clear('upgrade_status_project_projects');
  _update_cache_clear('upgrade_status_project_data');
  $projects = update_get_projects();

  // US: Special handling for obsolete projects.
  // Add replacement modules to the list of projects to get XML data for.
  foreach ($projects as $key => $project) {
    if (upgrade_status_obsolete($projects, $key)) {

      // Add the project that makes this one obsolete to the list of those to
      // grab information about.
      foreach ($projects[$key]['replaced_by'] as $replacement) {
        $projects[$replacement['name']] = array(
          'name' => $replacement['name'],
        );
      }
    }
  }

  // Now that we have the list of projects, we should also clear our cache of
  // available release data, since even if we fail to fetch new data, we need
  // to clear out the stale data at this point.
  _update_cache_clear('upgrade_status_available_releases::', TRUE);
  foreach ($projects as $key => $project) {
    upgrade_status_create_fetch_task($project);
  }
}