function locale_translation_get_file_history

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

Gets current translation status from the {locale_file} table.

Return value

array Array of translation file objects.

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. There is no direct replacement use \Drupal::service(CurrentImportStorage::class)->get() with the project and langcode instead.

See also

https://www.drupal.org/node/3037162

1 string reference to 'locale_translation_get_file_history'
drupal_static_reset in core/includes/bootstrap.inc
Resets one or all centrally stored static variable(s).

File

core/modules/locale/locale.module, line 454

Code

function locale_translation_get_file_history() {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. There is no direct replacement use \\Drupal::service(CurrentImportStorage::class)->get() with the project and langcode instead. See https://www.drupal.org/node/3037162', E_USER_DEPRECATED);
  // drupal_static() was removed as invalidation no longer happens.
  $history = [];
  // Get file history from the database.
  $result = \Drupal::database()->select('locale_file')
    ->fields('locale_file', [
    'project',
    'langcode',
    'filename',
    'version',
    'uri',
    'timestamp',
    'hash',
    'last_checked',
  ])
    ->execute()
    ->fetchAll();
  foreach ($result as $file) {
    $file->type = $file->timestamp ? LOCALE_TRANSLATION_CURRENT : '';
    $history[$file->project][$file->langcode] = $file;
  }
  return $history;
}

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