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'].
$context: Batch context array.
locale_translation_batch_fetch_sources()
locale_translation_batch_fetch_download()
locale_translation_batch_fetch_import()
locale_translation_batch_status_compare()
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');
}
}