You are here

function locale_translation_update_file_history in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/locale/locale.module \locale_translation_update_file_history()

Updates the {locale_file} table.

Parameters

object $file: Object representing the file just imported.

Return value

int FALSE on failure. Otherwise SAVED_NEW or SAVED_UPDATED.

3 calls to locale_translation_update_file_history()
locale_translate_batch_import_save in core/modules/locale/locale.bulk.inc
Implements callback_batch_operation().
locale_translation_source_build in core/modules/locale/locale.translation.inc
Builds abstract translation source.
locale_translation_status_save in core/modules/locale/locale.module
Saves the status of translation sources in static cache.

File

core/modules/locale/locale.module, line 841
Enables the translation of the user interface to languages other than English.

Code

function locale_translation_update_file_history($file) {
  $status = \Drupal::database()
    ->merge('locale_file')
    ->key([
    'project' => $file->project,
    'langcode' => $file->langcode,
  ])
    ->fields([
    'version' => $file->version,
    'timestamp' => $file->timestamp,
    'last_checked' => $file->last_checked,
  ])
    ->execute();

  // The file history has changed, flush the static cache now.
  // @todo Can we make this more fine grained?
  drupal_static_reset('locale_translation_get_file_history');
  return $status;
}