From 24116e6c114c49cac11a7895e6771fa234b10b5a Mon Sep 17 00:00:00 2001 From: tuutti Date: Fri, 6 Oct 2023 12:40:58 +0300 Subject: [PATCH] UHF-9099: Settings.php file is included multiple times during install, causing any function definitions to be declared multiple times --- public/sites/default/settings.php | 39 +++++++++++++++++-------------- 1 file changed, 21 insertions(+), 18 deletions(-) mode change 100644 => 100755 public/sites/default/settings.php diff --git a/public/sites/default/settings.php b/public/sites/default/settings.php old mode 100644 new mode 100755 index e75e801d..2fbf9661 --- a/public/sites/default/settings.php +++ b/public/sites/default/settings.php @@ -12,26 +12,29 @@ ini_set('zend.enable_gc', 'Off'); } -/** - * Gets the value of given environment variable. - * - * @param string|array $variables - * The variables to scan. - * - * @return mixed - * The value. - */ -function getenv_multiple(string|array $variables) : mixed { - if (!is_array($variables)) { - $variables = [$variables]; - } - foreach ($variables as $var) { - if ($value = getenv($var)) { - return $value; +if (!function_exists('drupal_get_env')) { + /** + * Gets the value of given environment variable. + * + * @param string|array $variables + * The variables to scan. + * + * @return mixed + * The value. + */ + function drupal_get_env(string|array $variables) : mixed { + if (!is_array($variables)) { + $variables = [$variables]; + } + + foreach ($variables as $var) { + if ($value = getenv($var)) { + return $value; + } } + return NULL; } - return NULL; } if ($simpletest_db = getenv('SIMPLETEST_DB')) { @@ -227,7 +230,7 @@ function getenv_multiple(string|array $variables) : mixed { $config['helfi_proxy.settings']['robots_header_enabled'] = (bool) $robots_header_enabled; } -$artemis_destination = getenv_multiple(['ARTEMIS_DESTINATION', 'PROJECT_NAME']); +$artemis_destination = drupal_get_env(['ARTEMIS_DESTINATION', 'NON_EXISTENT_TEST']); if ($artemis_brokers = getenv('ARTEMIS_BROKERS') && $artemis_destination) { $settings['stomp']['default'] = [