From 231d743ba9966e8304e0dd226ebf5eb7fb3b70d8 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 10 Nov 2012 23:34:27 +0100 Subject: [ticket/11152] Change phpbb_di_pass_cron to generic phpbb_di_pass_collection PHPBB3-11152 --- phpBB/common.php | 2 +- phpBB/config/services.yml | 7 ------ phpBB/download/file.php | 2 +- phpBB/includes/di/pass/collection.php | 47 +++++++++++++++++++++++++++++++++++ phpBB/includes/di/pass/cron.php | 38 ---------------------------- phpBB/install/database_update.php | 2 +- 6 files changed, 50 insertions(+), 48 deletions(-) create mode 100644 phpBB/includes/di/pass/collection.php delete mode 100644 phpBB/includes/di/pass/cron.php (limited to 'phpBB') diff --git a/phpBB/common.php b/phpBB/common.php index e24f9b4359..fb2f86341b 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -106,7 +106,7 @@ $phpbb_container = phpbb_create_compiled_container( new phpbb_di_extension_core($phpbb_root_path), ), array( - new phpbb_di_pass_cron(), + new phpbb_di_pass_collection('cron.task_collection', 'cron.task'), ), $phpbb_root_path, $phpEx diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 76a7049f19..42bb473e66 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -91,13 +91,6 @@ services: - .%core.php_ext% - @cache.driver - processor.ext: - class: phpbb_di_processor_ext - arguments: - - @ext.manager - tags: - - { name: container.processor } - request: class: phpbb_request diff --git a/phpBB/download/file.php b/phpBB/download/file.php index eb1ec85afe..b99ce2d688 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -65,7 +65,7 @@ if (isset($_GET['avatar'])) new phpbb_di_extension_core($phpbb_root_path), ), array( - new phpbb_di_pass_cron(), + new phpbb_di_pass_collection('cron.task_collection', 'cron.task'), ), $phpbb_root_path, $phpEx diff --git a/phpBB/includes/di/pass/collection.php b/phpBB/includes/di/pass/collection.php new file mode 100644 index 0000000000..09e4b08f62 --- /dev/null +++ b/phpBB/includes/di/pass/collection.php @@ -0,0 +1,47 @@ +collection_service = $collection_service; + $this->service_tag = $service_tag; + } + + /** + * Modify the container before it is passed to the rest of the code + * + * @param ContainerBuilder $container ContainerBuilder object + * @return null + */ + public function process(ContainerBuilder $container) + { + $definition = $container->getDefinition($this->collection_service); + + foreach ($container->findTaggedServiceIds($this->service_tag) as $id => $data) + { + $definition->addMethodCall('add', array($id)); + } + } +} diff --git a/phpBB/includes/di/pass/cron.php b/phpBB/includes/di/pass/cron.php deleted file mode 100644 index 53fe0a61c8..0000000000 --- a/phpBB/includes/di/pass/cron.php +++ /dev/null @@ -1,38 +0,0 @@ -getDefinition('cron.task_collection'); - - foreach ($container->findTaggedServiceIds('cron.task') as $id => $data) - { - $definition->addMethodCall('add', array($id)); - } - } -} diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index a5c4e2acd3..bc45b27cdc 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -123,7 +123,7 @@ $phpbb_container = phpbb_create_compiled_container( new phpbb_di_extension_core($phpbb_root_path), ), array( - new phpbb_di_pass_cron(), + new phpbb_di_pass_collection('cron.task_collection', 'cron.task'), ), $phpbb_root_path, $phpEx -- cgit v1.2.1