function locale_translation_update_file_history

Same name in other branches
  1. 9 core/modules/locale/locale.module \locale_translation_update_file_history()
  2. 10 core/modules/locale/locale.module \locale_translation_update_file_history()
  3. 11.x 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

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;
}

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