Dynamic config loading

- Move settings, defaults and dbstructure to directory 'static'
- Dynamic loading of config files (after the static loading)
- Filter out '-sample.config.php' and '-sample.ini.php' files
- Remove unnecessary ConfigFileManager
- Move ConfigFileLoader to Utils
- Add tests for multi-loading for INI, config and sample-filtering
This commit is contained in:
Philipp Holzer 2019-06-23 19:56:21 +02:00
parent 966043712f
commit 92fb0a82ca
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
25 changed files with 325 additions and 161 deletions

View file

@ -96,7 +96,7 @@ class DBStructure
* Loads the database structure definition from the config/dbstructure.config.php file.
* On first pass, defines DB_UPDATE_VERSION constant.
*
* @see config/dbstructure.config.php
* @see static/dbstructure.config.php
* @param boolean $with_addons_structure Whether to tack on addons additional tables
* @param string $basePath The base path of this application
* @return array
@ -106,16 +106,16 @@ class DBStructure
{
if (!self::$definition) {
$filename = $basePath . '/config/dbstructure.config.php';
$filename = $basePath . '/static/dbstructure.config.php';
if (!is_readable($filename)) {
throw new Exception('Missing database structure config file config/dbstructure.config.php');
throw new Exception('Missing database structure config file static/dbstructure.config.php');
}
$definition = require $filename;
if (!$definition) {
throw new Exception('Corrupted database structure config file config/dbstructure.config.php');
throw new Exception('Corrupted database structure config file static/dbstructure.config.php');
}
self::$definition = $definition;