locale_translation_download_source($source_file, $directory = 'temporary://')
Downloads a translation file from a remote server.
object $source_file: Source file object with at least:
string $directory: Directory where the downloaded file will be saved. Defaults to the temporary file path.
object File object if download was successful. FALSE on failure.
function locale_translation_download_source($source_file, $directory = 'temporary://') {
if ($uri = system_retrieve_file($source_file->uri, $directory)) {
$file = clone($source_file);
$file->type = LOCALE_TRANSLATION_LOCAL;
$file->uri = $uri;
$file->directory = $directory;
$file->timestamp = filemtime($uri);
return $file;
}
\Drupal::logger('locale')->error('Unable to download translation file @uri.', array('@uri' => $source_file->uri));
return FALSE;
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!locale!locale.batch.inc/function/locale_translation_download_source/8.1.x