function locale_translation_batch_fetch_update_status

Batch process: Update the download history table.

This batch process updates the {local_file} table with the data of imported gettext files. Import data is taken from $context['results']['sources'].

Parameters

$context: Batch context array.

See also

locale_translation_batch_fetch_sources()

locale_translation_batch_fetch_download()

locale_translation_batch_fetch_import()

locale_translation_batch_status_compare()

1 string reference to 'locale_translation_batch_fetch_update_status'
_locale_translation_fetch_operations in drupal/core/modules/locale/locale.fetch.inc
Helper function to construct the batch operations to fetch translations.

File

drupal/core/modules/locale/locale.batch.inc, line 388
Batch process to check the availability of remote or local po files.

Code

function locale_translation_batch_fetch_update_status(&$context) {
  $t = get_t();
  $results = array();
  if (isset($context['results']['sources'])) {
    foreach ($context['results']['sources'] as $project => $langcodes) {
      foreach ($langcodes as $langcode => $source) {

        // Store the state of the imported translations in {locale_file} table.
        // During the batch execution the data of the imported files is
        // temporary stored in $context['results']['sources']. Now it will be
        // stored in the database. Afterwards the temporary import and download
        // data can be deleted.
        if (isset($source->files[LOCALE_TRANSLATION_IMPORTED])) {
          $file = $source->files[LOCALE_TRANSLATION_IMPORTED];
          locale_translation_update_file_history($file);
          unset($source->files[LOCALE_TRANSLATION_IMPORTED]);
        }
        unset($source->files[LOCALE_TRANSLATION_DOWNLOADED]);

        // The source data is now up to date. Data of local and/or remote source
        // file is up to date including an updated time stamp. In a next batch
        // operation this can be used to update the translation status.
        $context['results']['sources'][$project][$langcode] = $source;
      }
    }
    $context['message'] = $t('Updated translations.');

    // The file history has changed, flush the static cache now.
    drupal_static_reset('locale_translation_get_file_history');
  }
}