From c6dc2134373cd6a9911ce4b6ba7f1ff7a43e0a0d Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Fri, 1 Dec 2023 23:37:33 -0500 Subject: [PATCH] error check folder creation --- setup/plugins/installFiles/l10nDownload.civi-setup.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setup/plugins/installFiles/l10nDownload.civi-setup.php b/setup/plugins/installFiles/l10nDownload.civi-setup.php index 5fbe1cd2e9..baaec23f73 100644 --- a/setup/plugins/installFiles/l10nDownload.civi-setup.php +++ b/setup/plugins/installFiles/l10nDownload.civi-setup.php @@ -55,7 +55,9 @@ if (!defined('CIVI_SETUP')) { } if (!is_dir($e->getModel()->paths['civicrm.l10n']['path'])) { \Civi\Setup::log()->info("Creating directory: " . $e->getModel()->paths['civicrm.l10n']['path']); - \CRM_Utils_File::createDir($e->getModel()->paths['civicrm.l10n']['path'], FALSE); + if (!mkdir($e->getModel()->paths['civicrm.l10n']['path'], 0777, TRUE)) { + $e->addError('system', 'l10nWritable', sprintf('Unable to create l10n directory "%s"', $e->getModel()->paths['civicrm.l10n']['path'])); + } } } }, \Civi\Setup::PRIORITY_MAIN); @@ -67,7 +69,9 @@ if (!defined('CIVI_SETUP')) { $downloadDir = $e->getModel()->paths['civicrm.l10n']['path'] . DIRECTORY_SEPARATOR . $lang . DIRECTORY_SEPARATOR . 'LC_MESSAGES'; if (!is_dir($downloadDir)) { \Civi\Setup::log()->info("Creating directory: " . $downloadDir); - \CRM_Utils_File::createDir($downloadDir, FALSE); + if (!mkdir($downloadDir, 0777, TRUE)) { + $e->addError('system', 'l10nWritable', sprintf('Unable to create language directory "%s"', $downloadDir)); + } foreach ($e->getModel()->moFiles as $moFile => $url) { $l10DownloadFile = str_replace('[locale]', $lang, $url); -- 2.25.1