mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/11152] Change phpbb_di_pass_cron to generic phpbb_di_pass_collection
PHPBB3-11152
This commit is contained in:
parent
798c006e7f
commit
231d743ba9
5 changed files with 15 additions and 13 deletions
|
@ -106,7 +106,7 @@ $phpbb_container = phpbb_create_compiled_container(
|
||||||
new phpbb_di_extension_core($phpbb_root_path),
|
new phpbb_di_extension_core($phpbb_root_path),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
new phpbb_di_pass_cron(),
|
new phpbb_di_pass_collection('cron.task_collection', 'cron.task'),
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
$phpEx
|
$phpEx
|
||||||
|
|
|
@ -91,13 +91,6 @@ services:
|
||||||
- .%core.php_ext%
|
- .%core.php_ext%
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
|
|
||||||
processor.ext:
|
|
||||||
class: phpbb_di_processor_ext
|
|
||||||
arguments:
|
|
||||||
- @ext.manager
|
|
||||||
tags:
|
|
||||||
- { name: container.processor }
|
|
||||||
|
|
||||||
request:
|
request:
|
||||||
class: phpbb_request
|
class: phpbb_request
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ if (isset($_GET['avatar']))
|
||||||
new phpbb_di_extension_core($phpbb_root_path),
|
new phpbb_di_extension_core($phpbb_root_path),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
new phpbb_di_pass_cron(),
|
new phpbb_di_pass_collection('cron.task_collection', 'cron.task'),
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
$phpEx
|
$phpEx
|
||||||
|
|
|
@ -18,8 +18,17 @@ if (!defined('IN_PHPBB'))
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
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
|
* 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)
|
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));
|
$definition->addMethodCall('add', array($id));
|
||||||
}
|
}
|
|
@ -123,7 +123,7 @@ $phpbb_container = phpbb_create_compiled_container(
|
||||||
new phpbb_di_extension_core($phpbb_root_path),
|
new phpbb_di_extension_core($phpbb_root_path),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
new phpbb_di_pass_cron(),
|
new phpbb_di_pass_collection('cron.task_collection', 'cron.task'),
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
$phpEx
|
$phpEx
|
||||||
|
|
Loading…
Add table
Reference in a new issue