1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-24 13:52:56 +02:00

fix(core): fix default and site settings loading #297

This commit is contained in:
Awilum
2019-11-15 20:19:22 +03:00
parent 6da5a2d368
commit 1cca53e76d

View File

@@ -54,19 +54,27 @@ $site_settings_file_path = PATH['config']['site'] . '/settings.yaml';
// Set settings if Flextype settings and Site settings config files exist
if (! Filesystem::has($default_settings_file_path) || ! Filesystem::has($site_settings_file_path)) {
throw new RuntimeException('Flextype settings and Site settings config files does not exist.');
throw new RuntimeException('Flextype settings or Site settings config files does not exist.');
}
if (($content = Filesystem::read($default_settings_file_path)) === false) {
throw new RuntimeException('Load file: ' . $default_settings_file_path . ' - failed!');
} else {
$default_settings = Yaml::decode($content);
if (trim($content) === '') {
$default_settings = [];
} else {
$default_settings = Yaml::decode($content);
}
}
if (($content = Filesystem::read($site_settings_file_path)) === false) {
throw new RuntimeException('Load file: ' . $site_settings_file_path . ' - failed!');
} else {
$site_settings = Yaml::decode($content);
if (trim($content) === '') {
$site_settings = [];
} else {
$site_settings = Yaml::decode($content);
}
}
// Merge settings