You are here

function l10n_update_available_releases in Localization update 7

Same name and namespace in other branches
  1. 6 l10n_update.check.inc \l10n_update_available_releases()

Fetch update information for all projects / all languages.

Parameters

boolean $refresh: TRUE = refresh the release data. We refresh anyway if the data is older than a day.

Return value

array Available releases indexed by project and language.

4 calls to l10n_update_available_releases()
l10n_update_admin_import_form_submit in ./l10n_update.admin.inc
Submit handler for Update form.
l10n_update_admin_overview in ./l10n_update.admin.inc
Page callback: Admin overview page.
l10n_update_available_updates in ./l10n_update.module
Get available updates.
_drush_l10n_update_get_updates in ./l10n_update.drush.inc
Helper function to obtain $updates.

File

./l10n_update.check.inc, line 30
Reusable API for l10n remote updates using $source objects

Code

function l10n_update_available_releases($refresh = FALSE) {
  $frequency = variable_get('l10n_update_check_frequency', 0) * 24 * 3600;
  if (!$refresh && ($cache = cache_get('l10n_update_available_releases', 'cache_l10n_update')) && (!$frequency || $cache->created > REQUEST_TIME - $frequency)) {
    return $cache->data;
  }
  else {
    $projects = l10n_update_get_projects(TRUE);
    $languages = l10n_update_language_list();
    $available = l10n_update_check_projects($projects, array_keys($languages));
    cache_set('l10n_update_available_releases', $available, 'cache_l10n_update', $frequency ? REQUEST_TIME + $frequency : CACHE_PERMANENT);
    return $available;
  }
}