function locale_translation_update_file_history

Same name and namespace in other branches
  1. 10 core/modules/locale/locale.module \locale_translation_update_file_history()
  2. 9 core/modules/locale/locale.module \locale_translation_update_file_history()
  3. 8.9.x core/modules/locale/locale.module \locale_translation_update_file_history()
  4. main core/modules/locale/locale.module \locale_translation_update_file_history()

Updates the {locale_file} table.

Parameters

object $source: Object representing the project just imported.

Return value

int FALSE on failure. Otherwise SAVED_NEW or SAVED_UPDATED.

3 calls to locale_translation_update_file_history()
LocaleImportBatch::batchSave in core/modules/locale/src/LocaleImportBatch.php
Implements callback_batch_operation().
LocaleSource::sourceBuild in core/modules/locale/src/LocaleSource.php
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 485

Code

function locale_translation_update_file_history($source) {
  $status = \Drupal::database()->merge('locale_file')
    ->keys([
    'project' => $source->project,
    'langcode' => $source->langcode,
  ])
    ->fields([
    'version' => $source->version,
    'timestamp' => $source->timestamp,
    'hash' => $source->hash,
    'last_checked' => $source->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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.