You are here

function l10n_update_update_file_history in Localization update 7.2

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.

See also

drupal_write_record()

3 calls to l10n_update_update_file_history()
l10n_update_batch_import_save in ./l10n_update.bulk.inc
Batch callback: Save data of imported files.
l10n_update_source_build in ./l10n_update.translation.inc
Builds abstract translation source.
l10n_update_status_save in ./l10n_update.module
Saves the status of translation sources in static cache.

File

./l10n_update.module, line 607
Download translations from remote localization server.

Code

function l10n_update_update_file_history($file) {

  // Update or write new record.
  if (db_query("SELECT project FROM {l10n_update_file} WHERE project = :project AND language = :langcode", array(
    ':project' => $file->project,
    ':langcode' => $file->langcode,
  ))
    ->fetchField()) {
    $update = array(
      'project',
      'language',
    );
  }
  else {
    $update = array();
  }
  $file->language = $file->langcode;
  $result = drupal_write_record('l10n_update_file', $file, $update);

  // The file history has changed, flush the static cache now.
  // @todo Can we make this more fine grained?
  drupal_static_reset('l10n_update_get_file_history');
  return $result;
}