aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2012-07-21 21:02:55 +0200
committerIgor Wiedler <igor@wiedler.ch>2012-07-21 21:02:55 +0200
commit50bc453aa6c91ae9c9df5cb633615825c9df7b6d (patch)
treeea051a18c77e7d4ee637f40af648f9ae5598fd4d
parent967cc550ed9bb74480f46212768502627f26d62d (diff)
downloadforums-50bc453aa6c91ae9c9df5cb633615825c9df7b6d.tar
forums-50bc453aa6c91ae9c9df5cb633615825c9df7b6d.tar.gz
forums-50bc453aa6c91ae9c9df5cb633615825c9df7b6d.tar.bz2
forums-50bc453aa6c91ae9c9df5cb633615825c9df7b6d.tar.xz
forums-50bc453aa6c91ae9c9df5cb633615825c9df7b6d.zip
[feature/dic] Load services from extensions
PHPBB3-10739
-rw-r--r--phpBB/common.php7
-rw-r--r--phpBB/config/services.yml7
-rw-r--r--phpBB/download/file.php7
-rw-r--r--phpBB/includes/di/processor/ext.php41
-rw-r--r--phpBB/install/index.php7
5 files changed, 66 insertions, 3 deletions
diff --git a/phpBB/common.php b/phpBB/common.php
index 406d8bb093..f958f06ce0 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -9,7 +9,6 @@
*/
use Symfony\Component\Config\FileLocator;
-use Symfony\Component\DependencyInjection\Compiler\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
@@ -102,6 +101,12 @@ $processor->process($phpbb_container);
$phpbb_class_loader = $phpbb_container->get('class_loader');
$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext');
+$ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor'));
+foreach ($ids as $id) {
+ $processor = $phpbb_container->get($id);
+ $processor->process($phpbb_container);
+}
+
// set up caching
$cache = $phpbb_container->get('cache');
diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml
index 20f9d67dd0..61497cbcc1 100644
--- a/phpBB/config/services.yml
+++ b/phpBB/config/services.yml
@@ -126,3 +126,10 @@ services:
- cron_lock
- @config
- @dbal.conn
+
+ processor.config:
+ class: phpbb_di_processor_ext
+ arguments:
+ - @ext.manager
+ tags:
+ - { name: container.processor }
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index d8fec8ef94..656f1f38d6 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -8,7 +8,6 @@
*/
use Symfony\Component\Config\FileLocator;
-use Symfony\Component\DependencyInjection\Compiler\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
@@ -62,6 +61,12 @@ if (isset($_GET['avatar']))
$phpbb_class_loader = $phpbb_container->get('class_loader');
$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext');
+ $ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor'));
+ foreach ($ids as $id) {
+ $processor = $phpbb_container->get($id);
+ $processor->process($phpbb_container);
+ }
+
// set up caching
$cache = $phpbb_container->get('cache');
diff --git a/phpBB/includes/di/processor/ext.php b/phpBB/includes/di/processor/ext.php
new file mode 100644
index 0000000000..b39ba5e686
--- /dev/null
+++ b/phpBB/includes/di/processor/ext.php
@@ -0,0 +1,41 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
+
+class phpbb_di_processor_ext implements phpbb_di_processor_interface
+{
+ private $extension_manager;
+
+ public function __construct($extension_manager)
+ {
+ $this->extension_manager = $extension_manager;
+ }
+
+ public function process(ContainerBuilder $container)
+ {
+ $enabled_exts = $this->extension_manager->all_enabled();
+ foreach ($enabled_exts as $name => $path) {
+ if (file_exists($path . '/config/services.yml')) {
+ $loader = new YamlFileLoader($container, new FileLocator($path . '/config'));
+ $loader->load('services.yml');
+ }
+ }
+ }
+}
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index 0e298c8cdc..1ba0798abc 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -8,7 +8,6 @@
*/
use Symfony\Component\Config\FileLocator;
-use Symfony\Component\DependencyInjection\Compiler\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
@@ -99,6 +98,12 @@ $phpbb_container->setAlias('cache.driver.install', 'cache.driver');
$phpbb_class_loader = $phpbb_container->get('class_loader');
$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext');
+$ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor'));
+foreach ($ids as $id) {
+ $processor = $phpbb_container->get($id);
+ $processor->process($phpbb_container);
+}
+
// set up caching
$cache = $phpbb_container->get('cache');