commit b32c99480c0232d7692a38792354438a6544794f
parent e9f583b9f1ee88bb48fca22dc79af536969274d5
Author: Jan Dankert <devnull@localhost>
Date: Tue, 29 May 2018 23:18:20 +0200
Fix: dot-notierte Konfigurationseinträge in Include-Konfigurationen korrekt einlesen.
Diffstat:
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/modules/configuration/Configuration.class.php b/modules/configuration/Configuration.class.php
@@ -33,6 +33,30 @@ class Configuration
{
$customConfig = Configuration::loadCustomConfig(self::$configFile);
+
+ // Resolve dot-notated configuration keys to arrays.
+ // Means: a.b.c is converted to array['a']['b']['c']
+ foreach ($customConfig as $key => $value) {
+ $parts = explode('.', $key);
+ if (count($parts) == 1)
+ ; // Kein Punkt enthalten. Dieser Konfigurationsschlüssel wird nicht geändert.
+ else {
+
+ if (count($parts) == 2)
+ $customConfig[$parts[0]][$parts[1]] = $value;
+ elseif (count($parts) == 3)
+ $customConfig[$parts[0]][$parts[1]][$parts[2]] = $value;
+ elseif (count($parts) == 4)
+ $customConfig[$parts[0]][$parts[1]][$parts[2]][$parts[3]] = $value;
+ elseif (count($parts) == 5)
+ $customConfig[$parts[0]][$parts[1]][$parts[2]][$parts[3]][$parts[4]] = $value;
+ elseif (count($parts) == 6)
+ $customConfig[$parts[0]][$parts[1]][$parts[2]][$parts[3]][$parts[4]][$parts[5]] = $value;
+ unset($customConfig[$key]);
+ }
+ }
+
+
// Den Dateinamen der Konfigurationsdatei in die Konfiguration schreiben.
$customConfig['config']['filename' ] = self::$configFile;
$customConfig['config']['last_modification_time'] = filemtime(self::$configFile);
@@ -42,12 +66,13 @@ class Configuration
return $customConfig;
}
+
/**
* Loads the configuration file an resolves all include-commands.
*
* @return array Configuration
*/
- public static function loadCustomConfig( $configFile )
+ private static function loadCustomConfig( $configFile )
{
if (!is_file($configFile) && !is_link($configFile)) {
error_log('Warning: Configuration file ' . $configFile . ' not found');
@@ -83,31 +108,6 @@ class Configuration
}
}
-
- // Resolve dot-notated configuration keys to arrays.
- // Means: a.b.c is converted to array['a']['b']['c']
- foreach ($customConfig as $key => $value) {
- $parts = explode('.', $key);
- if (count($parts) == 1)
- ; // Kein Punkt enthalten. Dieser Konfigurationsschlüssel wird nicht geändert.
- else {
-
- if (count($parts) == 2)
- $customConfig[$parts[0]][$parts[1]] = $value;
- elseif (count($parts) == 3)
- $customConfig[$parts[0]][$parts[1]][$parts[2]] = $value;
- elseif (count($parts) == 4)
- $customConfig[$parts[0]][$parts[1]][$parts[2]][$parts[3]] = $value;
- elseif (count($parts) == 5)
- $customConfig[$parts[0]][$parts[1]][$parts[2]][$parts[3]][$parts[4]] = $value;
- elseif (count($parts) == 6)
- $customConfig[$parts[0]][$parts[1]][$parts[2]][$parts[3]][$parts[4]][$parts[5]] = $value;
- unset($customConfig[$key]);
- }
- }
-
-
-
return $customConfig;
}