function update_status_project_cache in Update Status 5.2
Retrieve data from {cache_update_status} or empty the cache when necessary.
Two very expensive arrays computed by this module are the list of all installed modules (and .info data, project associations, etc), and the current status of the site relative to the currently available releases. These two arrays are cached in the {cache_update_status} table and used whenever possible. The cache is cleared whenever the administrator visits the status report, available updates report, or the module administration pages, since we should always recompute the most current values on any of those pages.
Parameters
$cid: The cache id of data to return from the cache. Valid options are 'update_status_project_data' and 'update_status_project_projects'.
Return value
The cached value of the $projects array generated by update_status_calculate_project_data() or update_status_get_projects(), or an empty array when the cache is cleared.
2 calls to update_status_project_cache()
- update_status_calculate_project_data in ./
update_status.module - Given the installed projects and the available release data retrieved from remote servers, calculate the current status.
- update_status_get_projects in ./
update_status.module - Fetch an array of installed and enabled projects.
File
- ./
update_status.module, line 1804
Code
function update_status_project_cache($cid) {
$projects = array();
// On certain paths, we should clear the cache and recompute the projects or
// update status of the site to avoid presenting stale information.
$q = $_GET['q'];
$paths = array(
'admin/build/modules',
'admin/logs',
'admin/logs/updates',
'admin/logs/status',
'admin/logs/updates/check',
);
if (in_array($q, $paths)) {
_update_status_cache_clear($cid);
}
else {
$cache = _update_status_cache_get($cid);
if (!empty($cache->data) && $cache->expire > time()) {
$projects = unserialize($cache->data);
}
}
return $projects;
}