From: Brice Maron Date: Wed, 6 Mar 2013 22:30:16 +0000 (+0100) Subject: Allow to load splited config files ref #946 X-Git-Tag: v6.0.0alpha2~934^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4994eaace15a53fc1f706874485761b5a992b3db;p=nextcloud-server.git Allow to load splited config files ref #946 --- diff --git a/lib/config.php b/lib/config.php index 0bd497b8e50..626dc8b02e3 100644 --- a/lib/config.php +++ b/lib/config.php @@ -130,14 +130,24 @@ class OC_Config{ return true; } - if( !file_exists( OC::$SERVERROOT."/config/config.php" )) { - return false; - } + // read all file in config dir ending by config.php + $config_files = glob( OC::$SERVERROOT."/config/*.config.php"); + + //Sort array naturally : + natsort($config_files); + + //Filter only regular files + $config_files = array_filter($config_files, 'is_file'); + + // Add default config + array_unshift($config_files,OC::$SERVERROOT."/config/config.php"); - // Include the file, save the data from $CONFIG - include OC::$SERVERROOT."/config/config.php"; - if( isset( $CONFIG ) && is_array( $CONFIG )) { - self::$cache = $CONFIG; + //Include file and merge config + foreach($config_files as $file){ + include $file; + if( isset( $CONFIG ) && is_array( $CONFIG )) { + self::$cache = array_merge(self::$cache, $CONFIG); + } } // We cached everything