You are here

function l10n_update_build_updates in Localization update 7

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

Compare available releases with history and get list of downloadable updates.

Parameters

$history: Update history of projects.

$available: Available project releases.

Return value

array Projects to be updated: 'not yet downloaded', 'newer timestamp available', 'new version available'. Up to date projects are not included in the array.

5 calls to l10n_update_build_updates()
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.
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
_drush_l10n_update_get_updates in ./l10n_update.drush.inc
Helper function to obtain $updates.

File

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

Code

function l10n_update_build_updates($history, $available) {
  $updates = array();
  foreach ($available as $name => $project_updates) {
    foreach ($project_updates as $lang => $update) {
      if (!empty($update->timestamp)) {
        $current = !empty($history[$name][$lang]) ? $history[$name][$lang] : NULL;

        // Add when not current, timestamp newer or version difers (newer version)
        if (_l10n_update_source_compare($current, $update) == -1 || $current->version != $update->version) {
          $updates[$name][$lang] = $update;
        }
      }
    }
  }
  return $updates;
}