function l10n_update_download_source in Localization update 7.2
Downloads a translation file from a remote server.
Parameters
object $source_file: Source file object with at least:
- "uri": uri to download the file from.
- "project": Project name.
- "langcode": Translation language.
- "version": Project version.
- "filename": File name.
string $directory: Directory where the downloaded file will be saved. Defaults to the temporary file path.
Return value
object|bool File object if download was successful. FALSE on failure.
1 call to l10n_update_download_source()
- l10n_update_batch_fetch_download in ./
l10n_update.batch.inc - Batch operation: Download a remote translation file.
File
- ./
l10n_update.batch.inc, line 233 - Batch process to check the availability of remote or local po files.
Code
function l10n_update_download_source($source_file, $directory = 'temporary://') {
if ($uri = system_retrieve_file($source_file->uri, $directory, FALSE, FILE_EXISTS_REPLACE)) {
$file = clone $source_file;
$file->type = L10N_UPDATE_LOCAL;
$file->uri = $uri;
$file->directory = $directory;
$file->timestamp = filemtime($uri);
return $file;
}
watchdog('l10n_update', 'Unable to download translation file @uri.', array(
'@uri' => $source_file->uri,
), WATCHDOG_ERROR);
return FALSE;
}