You are here

function l10n_update_source_download in Localization update 7

Same name and namespace in other branches
  1. 6 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->uri property.

Parameters

$source: Source object with all parameters

  • 'fileurl': url to download.
  • 'uri': 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 371
Reusable API for l10n remote updates using $source objects

Code

function l10n_update_source_download($source) {
  if (!empty($source->uri)) {
    $destination = $source->uri;
  }
  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->uri = $file;
    return $file;
  }
}