Allow to load splited config files ref #946
This commit is contained in:
parent
e5a497c924
commit
4994eaace1
|
@ -130,14 +130,24 @@ class OC_Config{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !file_exists( OC::$SERVERROOT."/config/config.php" )) {
|
// read all file in config dir ending by config.php
|
||||||
return false;
|
$config_files = glob( OC::$SERVERROOT."/config/*.config.php");
|
||||||
}
|
|
||||||
|
|
||||||
// Include the file, save the data from $CONFIG
|
//Sort array naturally :
|
||||||
include OC::$SERVERROOT."/config/config.php";
|
natsort($config_files);
|
||||||
if( isset( $CONFIG ) && is_array( $CONFIG )) {
|
|
||||||
self::$cache = $CONFIG;
|
//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 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
|
// We cached everything
|
||||||
|
|
Loading…
Reference in New Issue