[ticket/11152] Change phpbb_di_pass_cron to generic phpbb_di_pass_collection

PHPBB3-11152
This commit is contained in:
Igor Wiedler 2012-11-10 23:34:27 +01:00
parent 798c006e7f
commit 231d743ba9
5 changed files with 15 additions and 13 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -18,8 +18,17 @@ if (!defined('IN_PHPBB'))
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
class phpbb_di_pass_cron implements CompilerPassInterface
class phpbb_di_pass_collection implements CompilerPassInterface
{
private $collection_service;
private $service_tag;
public function __construct($collection_service, $service_tag)
{
$this->collection_service = $collection_service;
$this->service_tag = $service_tag;
}
/**
* Modify the container before it is passed to the rest of the code
*
@ -28,9 +37,9 @@ class phpbb_di_pass_cron implements CompilerPassInterface
*/
public function process(ContainerBuilder $container)
{
$definition = $container->getDefinition('cron.task_collection');
$definition = $container->getDefinition($this->collection_service);
foreach ($container->findTaggedServiceIds('cron.task') as $id => $data)
foreach ($container->findTaggedServiceIds($this->service_tag) as $id => $data)
{
$definition->addMethodCall('add', array($id));
}

View file

@ -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