You are here

function l10n_update_source_check_download in Localization update 7

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

Check remote file object.

Parameters

$source: Remote translation file object. The object will be update with data of the remote file:

  • 'type': Fixed value 'download'.
  • 'fileurl': File name and path.
  • 'timestamp': Last updated time.

@see l10n_update_source_build()

Return value

object An object containing the HTTP request headers, response code, headers, data, redirect status and updated timestamp. NULL if failure.

1 call to l10n_update_source_check_download()
l10n_update_source_check in ./l10n_update.check.inc
Check local and remote sources for the file.

File

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

Code

function l10n_update_source_check_download($source) {
  $url = l10n_update_build_string($source, $source->l10n_path);
  $result = l10n_update_http_check($url);
  if ($result && !empty($result->updated)) {
    $source->type = 'download';

    // There may have been redirects so we store the resulting url
    $source->fileurl = isset($result->redirect_url) ? $result->redirect_url : $url;
    $source->timestamp = $result->updated;
    return $result;
  }
}