From 71427b18854a67fb2221a8ede78e07e34ffea0aa Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Fri, 1 Dec 2023 23:26:37 -0500 Subject: [PATCH] if the lang subfolder already exists don't redownload --- .../installFiles/l10nDownload.civi-setup.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/setup/plugins/installFiles/l10nDownload.civi-setup.php b/setup/plugins/installFiles/l10nDownload.civi-setup.php index 96b006cbb2..5fbe1cd2e9 100644 --- a/setup/plugins/installFiles/l10nDownload.civi-setup.php +++ b/setup/plugins/installFiles/l10nDownload.civi-setup.php @@ -68,18 +68,18 @@ if (!defined('CIVI_SETUP')) { if (!is_dir($downloadDir)) { \Civi\Setup::log()->info("Creating directory: " . $downloadDir); \CRM_Utils_File::createDir($downloadDir, FALSE); - } - foreach ($e->getModel()->moFiles as $moFile => $url) { - $l10DownloadFile = str_replace('[locale]', $lang, $url); - \Civi\Setup::log() - ->info("Download translation '.$moFile.' from " . $l10DownloadFile . ' into ' . $downloadDir); - $client = new \GuzzleHttp\Client(); - $response = $client->get($l10DownloadFile); - if ($response->getStatusCode() == 200) { - $success = file_put_contents($downloadDir . DIRECTORY_SEPARATOR . $moFile, $response->getBody()); - if (!$success) { - $e->addError('l10n', 'download', 'Unable to download translation file'); + foreach ($e->getModel()->moFiles as $moFile => $url) { + $l10DownloadFile = str_replace('[locale]', $lang, $url); + \Civi\Setup::log() + ->info("Download translation '.$moFile.' from " . $l10DownloadFile . ' into ' . $downloadDir); + $client = new \GuzzleHttp\Client(); + $response = $client->get($l10DownloadFile); + if ($response->getStatusCode() == 200) { + $success = file_put_contents($downloadDir . DIRECTORY_SEPARATOR . $moFile, $response->getBody()); + if (!$success) { + $e->addError('l10n', 'download', 'Unable to download translation file'); + } } } } -- 2.25.1