From 119f90e36301463ffd01005a9390d3346be7774f Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Mon, 29 Jun 2015 22:15:08 +0200 Subject: [PATCH] [ticket/13891] Replaced ContainerBuilder with service_collection PHPBB3-13891 --- .../default/container/services_console.yml | 2 +- .../phpbb/console/command/reparser/list_all.php | 7 +++---- phpBB/phpbb/console/command/reparser/reparse.php | 16 ++++++++-------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/phpBB/config/default/container/services_console.yml b/phpBB/config/default/container/services_console.yml index 98a26b10e8..f39218ed9c 100644 --- a/phpBB/config/default/container/services_console.yml +++ b/phpBB/config/default/container/services_console.yml @@ -145,7 +145,7 @@ services: class: phpbb\console\command\reparser\list_all arguments: - @user - - @service_container + - @text_reparser_collection tags: - { name: console.command } diff --git a/phpBB/phpbb/console/command/reparser/list_all.php b/phpBB/phpbb/console/command/reparser/list_all.php index 10db568386..1589836ddd 100644 --- a/phpBB/phpbb/console/command/reparser/list_all.php +++ b/phpBB/phpbb/console/command/reparser/list_all.php @@ -15,7 +15,6 @@ namespace phpbb\console\command\reparser; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; class list_all extends \phpbb\console\command\command { @@ -28,13 +27,13 @@ class list_all extends \phpbb\console\command\command * Constructor * * @param \phpbb\user $user - * @param ContainerBuilder $container Container used to locate the reparsers + * @param \phpbb\di\service_collection $reparsers */ - public function __construct(\phpbb\user $user, ContainerBuilder $container) + public function __construct(\phpbb\user $user, \phpbb\di\service_collection $reparsers) { parent::__construct($user); $this->reparser_names = array(); - foreach (array_keys($container->findTaggedServiceIds('text_reparser.plugin')) as $name) + foreach ($reparsers as $name => $reparser) { // Store the names without the "text_reparser." prefix $this->reparser_names[] = str_replace('text_reparser.', '', $name); diff --git a/phpBB/phpbb/console/command/reparser/reparse.php b/phpBB/phpbb/console/command/reparser/reparse.php index f2bbe9c7d1..8cefee837f 100644 --- a/phpBB/phpbb/console/command/reparser/reparse.php +++ b/phpBB/phpbb/console/command/reparser/reparse.php @@ -20,21 +20,21 @@ use Symfony\Component\Console\Output\OutputInterface; class reparse extends \phpbb\console\command\command { /** - * @var \phpbb\textreparser\reparser_collection + * @var \phpbb\di\service_collection */ - protected $reparser_collection; + protected $reparsers; /** * Constructor * * @param \phpbb\user $user - * @param \phpbb\textreparser\reparser_collection $reparser_collection + * @param \phpbb\di\service_collection $reparser_collection */ - public function __construct(\phpbb\user $user, \phpbb\textreparser\reparser_collection $reparser_collection) + public function __construct(\phpbb\user $user, \phpbb\di\service_collection $reparsers) { require_once __DIR__ . '/../../../../includes/functions_content.php'; - $this->reparser_collection = $reparser_collection; + $this->reparsers = $reparsers; parent::__construct($user); } @@ -65,7 +65,7 @@ class reparse extends \phpbb\console\command\command if (isset($name)) { // Allow "post_text" to be an alias for "text_reparser.post_text" - if (!isset($this->reparser_collection[$name])) + if (!isset($this->reparsers[$name])) { $name = 'text_reparser.' . $name; } @@ -73,7 +73,7 @@ class reparse extends \phpbb\console\command\command } else { - foreach ($this->reparser_collection as $name => $service) + foreach ($this->reparsers as $name => $service) { $this->reparse($output, $name); } @@ -91,7 +91,7 @@ class reparse extends \phpbb\console\command\command */ protected function reparse(OutputInterface $output, $name) { - $reparser = $this->reparser_collection[$name]; + $reparser = $this->reparsers[$name]; $id = $reparser->get_max_id(); $n = 100; while ($id > 0)