You are here

function l10n_update_check_projects in Localization update 7

Same name and namespace in other branches
  1. 6 l10n_update.check.inc \l10n_update_check_projects()
  2. 7.2 l10n_update.compare.inc \l10n_update_check_projects()

Check latest release for project, language.

Parameters

$projects: Projects to check (objects).

$languages: Array of language codes to check, none to check all.

$check_local: Check local translation file.

$check_remote: Check remote translation file.

Return value

array Available sources indexed by project, language.

3 calls to l10n_update_check_projects()
l10n_update_available_releases in ./l10n_update.check.inc
Fetch update information for all projects / all languages.
l10n_update_language_refresh in ./l10n_update.check.inc
Language refresh. Runs a batch for loading the selected languages.
l10n_update_project_refresh in ./l10n_update.project.inc
Refresh projects after enabling modules

File

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

Code

function l10n_update_check_projects($projects, $languages = NULL, $check_local = NULL, $check_remote = NULL) {
  if (!isset($check_local)) {
    $check_local = (bool) (variable_get('l10n_update_check_mode', L10N_UPDATE_CHECK_ALL) & L10N_UPDATE_CHECK_LOCAL);
  }
  if (!isset($check_remote)) {
    $check_remote = (bool) (variable_get('l10n_update_check_mode', L10N_UPDATE_CHECK_ALL) & L10N_UPDATE_CHECK_REMOTE);
  }
  $languages = $languages ? $languages : array_keys(l10n_update_language_list());
  $result = array();
  foreach ($projects as $name => $project) {
    foreach ($languages as $lang) {
      $source = l10n_update_source_build($project, $lang);
      if ($update = l10n_update_source_check($source, $check_local, $check_remote)) {
        $result[$name][$lang] = $update;
      }
    }
  }
  return $result;
}