Make sure that configuration file exist

Fixes #105
This commit is contained in:
Fedor A. Fetisov 2016-12-23 15:17:33 +03:00
parent 0527a9def1
commit d512573af8

View File

@ -31,8 +31,14 @@ function load_system_configs()
static $configs = null;
if (is_null($configs)) {
// Make sure that configuration file exists, otherwise initialize empty config
if (file_exists(MIBEW_FS_ROOT . '/configs/config.yml')) {
$parser = new YamlParser();
$configs = $parser->parse(file_get_contents(MIBEW_FS_ROOT . '/configs/config.yml'));
}
else {
$configs = array();
}
// Mailer configs are not necessary and can be omitted but the section
// must exist anyway. Empty statement is used to make sure null, false