aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/phpbb/di/extension/ext.php28
-rw-r--r--tests/di/create_container_test.php4
-rw-r--r--tests/di/fixtures/ext/vendor/disabled/config/production/environment.yml (renamed from tests/di/fixtures/ext/vendor/disabled/config/services.yml)0
-rw-r--r--tests/di/fixtures/ext/vendor/enabled-2/config/production/environment.yml2
-rw-r--r--tests/di/fixtures/ext/vendor/enabled-3/config/services.yml2
-rw-r--r--tests/di/fixtures/ext/vendor/enabled/config/default/environment.yml (renamed from tests/di/fixtures/ext/vendor/enabled/config/services.yml)0
6 files changed, 33 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);
}
}
}
diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php
index ecfe504775..ec9828debb 100644
--- a/tests/di/create_container_test.php
+++ b/tests/di/create_container_test.php
@@ -59,6 +59,8 @@ namespace
// Checks use_extensions
$this->assertTrue($container->hasParameter('enabled'));
+ $this->assertTrue($container->hasParameter('enabled_2'));
+ $this->assertTrue($container->hasParameter('enabled_3'));
$this->assertFalse($container->hasParameter('disabled'));
$this->assertFalse($container->hasParameter('available'));
@@ -201,6 +203,8 @@ namespace phpbb\db\driver
{
return array(
array('ext_name' => 'vendor/enabled'),
+ array('ext_name' => 'vendor/enabled-2'),
+ array('ext_name' => 'vendor/enabled-3'),
);
}
}
diff --git a/tests/di/fixtures/ext/vendor/disabled/config/services.yml b/tests/di/fixtures/ext/vendor/disabled/config/production/environment.yml
index 31ada384bf..31ada384bf 100644
--- a/tests/di/fixtures/ext/vendor/disabled/config/services.yml
+++ b/tests/di/fixtures/ext/vendor/disabled/config/production/environment.yml
diff --git a/tests/di/fixtures/ext/vendor/enabled-2/config/production/environment.yml b/tests/di/fixtures/ext/vendor/enabled-2/config/production/environment.yml
new file mode 100644
index 0000000000..feeb5a7a2d
--- /dev/null
+++ b/tests/di/fixtures/ext/vendor/enabled-2/config/production/environment.yml
@@ -0,0 +1,2 @@
+parameters:
+ enabled_2: true
diff --git a/tests/di/fixtures/ext/vendor/enabled-3/config/services.yml b/tests/di/fixtures/ext/vendor/enabled-3/config/services.yml
new file mode 100644
index 0000000000..0dae35d2bd
--- /dev/null
+++ b/tests/di/fixtures/ext/vendor/enabled-3/config/services.yml
@@ -0,0 +1,2 @@
+parameters:
+ enabled_3: true
diff --git a/tests/di/fixtures/ext/vendor/enabled/config/services.yml b/tests/di/fixtures/ext/vendor/enabled/config/default/environment.yml
index 88a7919ed1..88a7919ed1 100644
--- a/tests/di/fixtures/ext/vendor/enabled/config/services.yml
+++ b/tests/di/fixtures/ext/vendor/enabled/config/default/environment.yml