You are here

function l10n_update_flag_history in Localization update 7

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

Flag the file history as up to date.

Compare history data in the {l10n_update_file} table with translations available at translations server(s). Update the 'last_checked' timestamp of the files which are up to date.

Parameters

$available: Available translations as retreived from remote server.

1 call to l10n_update_flag_history()
l10n_update_admin_import_form_submit in ./l10n_update.admin.inc
Submit handler for Update form.

File

./l10n_update.inc, line 224

Code

function l10n_update_flag_history($available) {
  if ($history = l10n_update_get_history()) {
    foreach ($history as $name => $project) {
      foreach ($project as $langcode => $current) {
        if (isset($available[$name][$langcode])) {
          $update = $available[$name][$langcode];

          // When the available update is equal to the current translation the current
          // is marked checked in the {l10n_update_file} table.
          if (_l10n_update_source_compare($current, $update) == 0 && $current->version == $update->version) {
            db_update('l10n_update_file')
              ->fields(array(
              'last_checked' => REQUEST_TIME,
            ))
              ->condition('project', $current->project)
              ->condition('language', $current->language)
              ->execute();
          }
        }
      }
    }
  }
}