function update_status_get_available in Update Status 5.2
Internal helper to try to get the update information from the cache if possible, and to refresh the cache when necessary.
Parameters
$refresh: Boolean to indicate if this method should refresh the cache automatically if there's no data.
3 calls to update_status_get_available()
- update_status_requirements in ./
update_status.module - Implementation of hook_requirements.
- update_status_settings in ./
update_status.module - Menu callback. Show the settings for the update status module.
- update_status_status in ./
update_status.module - Menu callback. Generate a page about the update status of projects.
File
- ./
update_status.module, line 1644
Code
function update_status_get_available($refresh = FALSE) {
$available = array();
// First, make sure that none of the .info files have a change time newer
// than the last time we checked for available updates. If something was
// changed, it almost certainly means a new version was installed. Without
// fresh data, the logic in update_status_calculate_project_data() will be
// wrong and produce confusing, bogus results.
$needs_refresh = FALSE;
$last_check = variable_get('update_status_last', 0);
$projects = update_status_get_projects();
foreach ($projects as $key => $project) {
if ($project['info']['_info_file_ctime'] > $last_check) {
$needs_refresh = TRUE;
break;
}
}
if (!$needs_refresh && ($cache = _update_status_cache_get('update_status_available_releases')) && $cache->expire > time()) {
$available = unserialize($cache->data);
}
elseif ($needs_refresh || $refresh) {
$available = update_status_refresh();
}
return $available;
}