Skip to content

Commit

Permalink
Make sure appropriate defaults for omitted configs are used
Browse files Browse the repository at this point in the history
  • Loading branch information
JustBlackBird committed Jun 8, 2015
1 parent aa0c213 commit 5363698
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/mibew/libs/common/configurations.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5363698

Please sign in to comment.