From 47674cb473dc78952d0a2e999be8f6f2895709a9 Mon Sep 17 00:00:00 2001 From: "Aldo \"xoen\" Giambelluca" Date: Mon, 12 Jul 2010 19:58:45 +0200 Subject: [PATCH] Improved OC_CONFIG::saveConfiguration() * Support numeric types too * $WEBROOT variable was not necessary --- inc/lib_config.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/inc/lib_config.php b/inc/lib_config.php index bb713019f24..ff4ead8b6be 100644 --- a/inc/lib_config.php +++ b/inc/lib_config.php @@ -113,23 +113,24 @@ class OC_CONFIG{ /** * Write the configuration to the `config.php` file * - * $configuration contains key/value + * $configuration contains key/value pairs * - the key is the option name without the 'CONFIG_' prefix - * - the value is a string or a boolean + * - the value is a string, a boolean or a number * * @param array $configuration is an associative array */ protected static function saveConfiguration($configuration) { global $SERVERROOT; - global $WEBROOT; $configContent = ' $value ) { if ( is_string($value) ) { - $configContent .= "\n\$CONFIG_$key = '$value';"; + $configContent .= "\n\$CONFIG_$key = '$value';"; // e.g. $CONFIG_DBTYPE = 'mysql'; } else if ( is_bool($value) ) { $value = $value ? 'true' : 'false'; - $configContent .= "\n\$CONFIG_$key = $value;"; + $configContent .= "\n\$CONFIG_$key = $value;"; // e.g. $CONFIG_INSTALLED = true; + } else if ( is_numeric($value) ) { + $configContent .= "\n\$CONFIG_$key = $value;"; // e.g. $CONFIG_PI = 3.14; } } $filename = "$SERVERROOT/config/config.php"; -- 2.39.5