Skip to content

Commit

Permalink
UHF-9099: Settings.php file is included multiple times during install…
Browse files Browse the repository at this point in the history
…, causing any function definitions to be declared multiple times
  • Loading branch information
tuutti committed Oct 6, 2023
1 parent c11f451 commit 24116e6
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions public/sites/default/settings.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down Expand Up @@ -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'] = [
Expand Down

0 comments on commit 24116e6

Please sign in to comment.