function locale_translation_get_file_history

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

5 calls to locale_translation_get_file_history()
LocaleUpdateCronTest::testUpdateCron in core/modules/locale/tests/src/Functional/LocaleUpdateCronTest.php
Tests interface translation update using cron.
LocaleUpdateTest::testEnableUninstallModule in core/modules/locale/tests/src/Functional/LocaleUpdateTest.php
Tests automatic translation import when a module is enabled.
LocaleUpdateTest::testUpdateImportSourceLocal in core/modules/locale/tests/src/Functional/LocaleUpdateTest.php
Tests translation import from local sources.
LocaleUpdateTest::testUpdateImportSourceRemote in core/modules/locale/tests/src/Functional/LocaleUpdateTest.php
Tests translation import from remote sources.
locale_translation_source_build in core/modules/locale/locale.translation.inc
Builds abstract translation source.
4 string references to 'locale_translation_get_file_history'
LocaleUpdateCronTest::testUpdateCron in core/modules/locale/tests/src/Functional/LocaleUpdateCronTest.php
Tests interface translation update using cron.
LocaleUpdateTest::testUpdateImportSourceLocal in core/modules/locale/tests/src/Functional/LocaleUpdateTest.php
Tests translation import from local sources.
LocaleUpdateTest::testUpdateImportSourceRemote in core/modules/locale/tests/src/Functional/LocaleUpdateTest.php
Tests translation import from remote sources.
locale_translation_update_file_history in core/modules/locale/locale.module
Updates the {locale_file} table.

File

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

Code

function locale_translation_get_file_history() {
    $history =& drupal_static(__FUNCTION__, []);
    if (empty($history)) {
        // Get file history from the database.
        $result = \Drupal::database()->query('SELECT [project], [langcode], [filename], [version], [uri], [timestamp], [last_checked] FROM {locale_file}');
        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.