aboutsummaryrefslogtreecommitdiffstats
path: root/lib/config.php
diff options
context:
space:
mode:
authorBrice Maron <brice@bmaron.net>2013-03-06 23:30:16 +0100
committerBrice Maron <brice@bmaron.net>2013-03-06 23:30:16 +0100
commit4994eaace15a53fc1f706874485761b5a992b3db (patch)
tree908caa3d15f2640a0f0383204e736f47f7db2e60 /lib/config.php
parente5a497c9248fcab82b84befbc3842affccc71f9d (diff)
downloadnextcloud-server-4994eaace15a53fc1f706874485761b5a992b3db.tar.gz
nextcloud-server-4994eaace15a53fc1f706874485761b5a992b3db.zip
Allow to load splited config files ref #946
Diffstat (limited to 'lib/config.php')
-rw-r--r--lib/config.php24
1 files changed, 17 insertions, 7 deletions
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