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)) {
$parser = new YamlParser();
$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
// section must exist anyway.
'mailer' => array(),
// Cache section must extst too.
'cache' => array(),
);
// Mailer configs are not necessary and can be omited but the section
// must exist anyway. Empty statement is used to make sure null, false
// and "" will be converted to an empty array.
if (empty($configs['mailer'])) {
$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;