From cd89c9e1a425c3997714b3abc6668bbc3974f325 Mon Sep 17 00:00:00 2001 From: Awilum Date: Sat, 27 Jun 2020 09:19:21 +0300 Subject: [PATCH] fix(core): fix flextype config loading. BREAKING CHANGES 1. /project/config/settings.yaml move to /project/config/flextype/settings.yaml 2. remove constant PATH['config'], use - PATH['project'] . '/config/' --- index.php | 1 - src/flextype/bootstrap.php | 8 ++++---- src/flextype/core/Plugins/Plugins.php | 2 +- src/flextype/{config => }/flextype.yaml | 0 src/flextype/{config => }/locales.yaml | 0 src/flextype/{config => }/settings.yaml | 0 6 files changed, 5 insertions(+), 6 deletions(-) rename src/flextype/{config => }/flextype.yaml (100%) rename src/flextype/{config => }/locales.yaml (100%) rename src/flextype/{config => }/settings.yaml (100%) diff --git a/index.php b/index.php index aa82c39a..c680af3f 100755 --- a/index.php +++ b/index.php @@ -33,7 +33,6 @@ define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd())); */ define('PATH', [ 'project' => ROOT_DIR . '/project', - 'config' => ROOT_DIR . '/src/flextype/config', 'cache' => ROOT_DIR . '/var/cache', 'logs' => ROOT_DIR . '/var/logs', ]); diff --git a/src/flextype/bootstrap.php b/src/flextype/bootstrap.php index 4afa89a3..91afbab6 100755 --- a/src/flextype/bootstrap.php +++ b/src/flextype/bootstrap.php @@ -43,12 +43,12 @@ $registry = new Registry(); * 3. Merge settings. * 4. Store settings in the flextype registry. */ -$flextype_manifest_file_path = PATH['config'] . '/flextype.yaml'; -$default_flextype_settings_file_path = PATH['config'] . '/settings.yaml'; -$custom_flextype_settings_file_path = PATH['project'] . '/config/settings.yaml'; +$flextype_manifest_file_path = ROOT_DIR . '/src/flextype/flextype.yaml'; +$default_flextype_settings_file_path = ROOT_DIR . '/src/flextype/settings.yaml'; +$custom_flextype_settings_file_path = PATH['project'] . '/config/flextype/settings.yaml'; // Create config dir -! Filesystem::has(PATH['project'] . '/config/') and Filesystem::createDir(PATH['project'] . '/config/'); +! Filesystem::has(PATH['project'] . '/config/flextype/') and Filesystem::createDir(PATH['project'] . '/config/flextype/'); // Set settings if Flextype Default settings config files exist if (! Filesystem::has($default_flextype_settings_file_path)) { diff --git a/src/flextype/core/Plugins/Plugins.php b/src/flextype/core/Plugins/Plugins.php index 41716363..85d1ec36 100755 --- a/src/flextype/core/Plugins/Plugins.php +++ b/src/flextype/core/Plugins/Plugins.php @@ -44,7 +44,7 @@ class Plugins public function __construct($flextype, $app) { $this->flextype = $flextype; - $this->locales = $this->flextype['serializer']->decode(Filesystem::read(ROOT_DIR . '/src/flextype/config/locales.yaml'), 'yaml'); + $this->locales = $this->flextype['serializer']->decode(Filesystem::read(ROOT_DIR . '/src/flextype/locales.yaml'), 'yaml'); } /** diff --git a/src/flextype/config/flextype.yaml b/src/flextype/flextype.yaml similarity index 100% rename from src/flextype/config/flextype.yaml rename to src/flextype/flextype.yaml diff --git a/src/flextype/config/locales.yaml b/src/flextype/locales.yaml similarity index 100% rename from src/flextype/config/locales.yaml rename to src/flextype/locales.yaml diff --git a/src/flextype/config/settings.yaml b/src/flextype/settings.yaml similarity index 100% rename from src/flextype/config/settings.yaml rename to src/flextype/settings.yaml