You are here

function l10n_update_source_check in Localization update 7

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

Check local and remote sources for the file.

Parameters

$source: Translation source object. @see l10n_update_source_build()

$check_local: File object of local translation file.

$check_remote: File object of remote translation file.

Return value

object File object of most recent translation; local or remote.

2 calls to l10n_update_source_check()
l10n_update_check_projects in ./l10n_update.check.inc
Check latest release for project, language.
l10n_update_check_translations in ./l10n_update.check.inc
Check updates for active projects and languages.

File

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

Code

function l10n_update_source_check($source, $check_local = TRUE, $check_remote = TRUE) {
  $local = $remote = NULL;
  if ($check_local) {
    $check = clone $source;
    if (l10n_update_source_check_file($check)) {
      $local = $check;
    }
  }
  if ($check_remote) {
    $check = clone $source;
    if (l10n_update_source_check_download($check)) {
      $remote = $check;
    }
  }

  // Get remote if newer than local only, they both can be empty
  return _l10n_update_source_compare($local, $remote) < 0 ? $remote : $local;
}