diff options
author | eMerzh <brice@bmaron.net> | 2013-04-09 09:56:16 -0700 |
---|---|---|
committer | eMerzh <brice@bmaron.net> | 2013-04-09 09:56:16 -0700 |
commit | 8db76ef7d2042585cda983da1d521721cc6561b6 (patch) | |
tree | 5e233a78d8dd9dfd00c7ca3fc5951705c4f20694 /lib/config.php | |
parent | be47f7706027223588ee2e7eddb9434fc88bf785 (diff) | |
parent | d5da94acbcc53e310a1970af12af6712eb374a09 (diff) | |
download | nextcloud-server-8db76ef7d2042585cda983da1d521721cc6561b6.tar.gz nextcloud-server-8db76ef7d2042585cda983da1d521721cc6561b6.zip |
Merge pull request #2147 from eMerzh/split_config
[OC6] Allow to load splited config files
Diffstat (limited to 'lib/config.php')
-rw-r--r-- | lib/config.php | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/config.php b/lib/config.php index c94eb278159..9b87d4ce4e5 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"); + + //Filter only regular files + $config_files = array_filter($config_files, 'is_file'); + + //Sort array naturally : + natsort($config_files); + + // 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 |