You are here

function l10n_update_source_import in Localization update 7

Same name and namespace in other branches
  1. 6 l10n_update.check.inc \l10n_update_source_import()

Import source into locales table.

Parameters

$source: Translation source object with information about the file location. Object will be updated with :

  • 'last_checked': Timestamp of current time;
  • 'import_date': Timestamp of current time;

$mode: Download mode. How to treat exising and modified translations.

Return value

boolean Result array on success, FALSE on failure.

2 calls to l10n_update_source_import()
l10n_update_source_update in ./l10n_update.check.inc
Download and import or just import source, depending on type.
_l10n_update_batch_import in ./l10n_update.batch.inc
Batch process: Import translation file.

File

./l10n_update.check.inc, line 339
Reusable API for l10n remote updates using $source objects

Code

function l10n_update_source_import($source, $mode) {
  if (!empty($source->uri) && ($result = l10n_update_import_file($source->uri, $source->language, $mode))) {
    $source->last_checked = REQUEST_TIME;

    // We override the file timestamp here. The default file time stamp is the
    // release date from the l.d.o server. We change the timestamp to the
    // creation time on the webserver. On multi sites that share a common
    // sites/all/translations directory, the sharing sites use the local file
    // creation date as release date. Without this correction the local
    // file is always newer than the l.d.o. file, which results in unnecessary
    // translation import.
    $source->timestamp = time();
    return $result;
  }
}