diff options
| author | Tristan Darricau <github@nicofuma.fr> | 2014-09-05 02:29:15 +0200 |
|---|---|---|
| committer | Tristan Darricau <github@nicofuma.fr> | 2014-11-20 19:06:47 +0100 |
| commit | 0bf3d2d962c33ffa606d38e91d04665b78fbd8bc (patch) | |
| tree | ad78962b1bb877ec0971ef7663847607db48d0ea /phpBB/phpbb | |
| parent | 0306fefe04ca987caa1a04bcc105ba76e8d01d9a (diff) | |
| download | forums-0bf3d2d962c33ffa606d38e91d04665b78fbd8bc.tar forums-0bf3d2d962c33ffa606d38e91d04665b78fbd8bc.tar.gz forums-0bf3d2d962c33ffa606d38e91d04665b78fbd8bc.tar.bz2 forums-0bf3d2d962c33ffa606d38e91d04665b78fbd8bc.tar.xz forums-0bf3d2d962c33ffa606d38e91d04665b78fbd8bc.zip | |
[ticket/12620] Add the support of the environments for the ext services
We look for an environment.yml file in the config/PHPBB_ENVIRONMENT/
directory of the extensionss. If the directory does not exist we look
for the environment.yml file in the 'default' environment and finally
for the services.yml file in the config/ directory.
PHPBB3-12620
Diffstat (limited to 'phpBB/phpbb')
| -rw-r--r-- | phpBB/phpbb/di/extension/ext.php | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/phpBB/phpbb/di/extension/ext.php b/phpBB/phpbb/di/extension/ext.php index 718c992d2e..330303ca0c 100644 --- a/phpBB/phpbb/di/extension/ext.php +++ b/phpBB/phpbb/di/extension/ext.php @@ -45,10 +45,32 @@ class ext extends Extension { foreach ($this->paths as $path) { - if (file_exists($path . '/config/services.yml')) + $services_directory = false; + $services_file = false; + + if (file_exists($path . 'config/' . PHPBB_ENVIRONMENT . '/environment.yml')) + { + $services_directory = $path . 'config/' . PHPBB_ENVIRONMENT; + $services_file = 'environment.yml'; + } + else if (!is_dir($path . 'config/' . PHPBB_ENVIRONMENT)) + { + if (file_exists($path . 'config/default/environment.yml')) + { + $services_directory = $path . 'config/default'; + $services_file = 'environment.yml'; + } + else if (!is_dir($path . 'config/default') && file_exists($path . '/config/services.yml')) + { + $services_directory = $path . 'config'; + $services_file = 'services.yml'; + } + } + + if ($services_directory && $services_file) { - $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($path . '/config'))); - $loader->load('services.yml'); + $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($services_directory))); + $loader->load($services_file); } } } |
