Make sure appropriate defaults for omitted configs are used

This commit is contained in:
Dmitriy Simushev 2015-06-08 14:20:21 +00:00
parent aa0c213cc3
commit 5363698020

View File

@ -33,13 +33,19 @@ function load_system_configs()
if (is_null($configs)) { if (is_null($configs)) {
$parser = new YamlParser(); $parser = new YamlParser();
$configs = $parser->parse(file_get_contents(MIBEW_FS_ROOT . '/configs/config.yml')); $configs = $parser->parse(file_get_contents(MIBEW_FS_ROOT . '/configs/config.yml'));
$configs += array(
// Mailer configs are not necessary and can be omited but the // Mailer configs are not necessary and can be omited but the section
// section must exist anyway. // must exist anyway. Empty statement is used to make sure null, false
'mailer' => array(), // and "" will be converted to an empty array.
// Cache section must extst too. if (empty($configs['mailer'])) {
'cache' => array(), $configs['mailer'] = array();
); }
// Cache section must extst too. The logic behind "empty" statement is
// the same as above.
if (empty($configs['cache'])) {
$configs['cache'] = array();
}
} }
return $configs; return $configs;