update_project_cache

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/update/update.compare.inc, строка 612

Версии
6
update_project_cache($cid)

Retrieve data from {cache_update} or empty the cache when necessary.

Two very expensive arrays computed by this module are the list of all installed modules and themes (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} table and used whenever possible. The cache is cleared whenever the administrator visits the status report, available updates report, or the module or theme administration pages, since we should always recompute the most current values on any of those pages.

Note: while both of these arrays are expensive to compute (in terms of disk I/O and some fairly heavy CPU processing), neither of these is the actual data about available updates that we have to fetch over the network from updates.drupal.org. That information is stored with the 'update_available_releases' cache ID -- it needs to persist longer than 1 hour and never get invalidated just by visiting a page on the site.

Параметры

$cid The cache id of data to return from the cache. Valid options are 'update_project_data' and 'update_project_projects'.

Возвращаемое значение

The cached value of the $projects array generated by update_calculate_project_data() or update_get_projects(), or an empty array when the cache is cleared.

▾ 2 функции вызывают update_project_cache()

update_calculate_project_data in modules/update/update.compare.inc
Определяет текущий статус обновления сайта по данным установленных модулей, а также доступных релизов, полученных от внешних серверов.
update_get_projects in modules/update/update.compare.inc
Fetch an array of installed and enabled projects.

Код

<?php
function update_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/build/themes', 'admin/reports', 'admin/reports/updates', 'admin/reports/status', 'admin/reports/updates/check');
  if (in_array($q, $paths)) {
    _update_cache_clear($cid);
  }
  else {
    $cache = _update_cache_get($cid);
    if (!empty($cache->data) && $cache->expire > time()) {
      $projects = $cache->data;
    }
  }
  return $projects;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему