]> source.dussan.org Git - nextcloud-server.git/commitdiff
Improved OC_CONFIG::saveConfiguration()
authorAldo "xoen" Giambelluca <xoen@xoen.org>
Mon, 12 Jul 2010 17:58:45 +0000 (19:58 +0200)
committerAldo "xoen" Giambelluca <xoen@xoen.org>
Mon, 12 Jul 2010 18:45:57 +0000 (20:45 +0200)
  * Support numeric types too
  * $WEBROOT variable was not necessary

inc/lib_config.php

index bb713019f245154878d9dc23cba70d1219fa2e68..ff4ead8b6be500e1af6e7d90ac0a3994364c3bc3 100644 (file)
@@ -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 = '<?php';
                foreach ( $configuration as $key => $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";