function l10n_update_source_download in Localization update 6
Same name and namespace in other branches
- 7 l10n_update.check.inc \l10n_update_source_download()
Download source file from remote server.
If succesful this function returns the downloaded file in two ways:
- As a temporary $file object
- As a file path on the $source->filepath property.
Parameters
$source: Source object with all parameters
- 'fileurl': url to download.
- 'filepath': alternate destination. If not present a temporary file will be used and the path returned here.
Return value
object $file object if download successful.
2 calls to l10n_update_source_download()
- l10n_update_source_update in ./
l10n_update.check.inc - Download and import or just import source, depending on type.
- _l10n_update_batch_download in ./
l10n_update.batch.inc - Batch process: Download a file.
File
- ./
l10n_update.check.inc, line 349 - Reusable API for l10n remote updates using $source objects
Code
function l10n_update_source_download($source) {
if (!empty($source->filepath)) {
$destination = $source->filepath;
}
elseif ($directory = variable_get('l10n_update_download_store', '')) {
$destination = $directory . '/' . $source->filename;
}
else {
$destination = NULL;
}
if ($file = l10n_update_download_file($source->fileurl, $destination)) {
$source->filepath = $file;
return $file;
}
}