From b95ab440280ca5e5e94fe1f96f4f947734e37da3 Mon Sep 17 00:00:00 2001 From: Carlo Date: Sat, 12 Jul 2014 17:19:43 +0200 Subject: [ticket/12685] Add console collection and fixing CLI Added a commands service collection and removed CLI container PHPBB3-12685 --- phpBB/phpbb/console/application.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php index b1f0635913..72fcee5cfa 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -17,7 +17,7 @@ use Symfony\Component\Console\Shell; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\DependencyInjection\TaggedContainerInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; class application extends \Symfony\Component\Console\Application { @@ -73,14 +73,13 @@ class application extends \Symfony\Component\Console\Application /** * Register a set of commands from the container * - * @param TaggedContainerInterface $container The container - * @param string $tag The tag used to register the commands + * @param ContainerInterface $container The container */ - public function register_container_commands(TaggedContainerInterface $container, $tag = 'console.command') + public function register_container_commands(ContainerInterface $container) { - foreach($container->findTaggedServiceIds($tag) as $id => $void) + foreach($container->get('console.command_collection') as $service_command) { - $this->add($container->get($id)); + $this->add($service_command); } } -- cgit v1.2.1 From 1125fb3cabf7a69dc4cac852efd655ce2afcd7a0 Mon Sep 17 00:00:00 2001 From: Carlo Date: Fri, 20 Jun 2014 09:58:51 +0000 Subject: [ticket/12685] Add space after foreach PHPBB3-12685 --- phpBB/phpbb/console/application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php index 72fcee5cfa..2aef48c93b 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -77,7 +77,7 @@ class application extends \Symfony\Component\Console\Application */ public function register_container_commands(ContainerInterface $container) { - foreach($container->get('console.command_collection') as $service_command) + foreach ($container->get('console.command_collection') as $service_command) { $this->add($service_command); } -- cgit v1.2.1 From 2ec50c0ff15837489f36b014a2e36470b1672508 Mon Sep 17 00:00:00 2001 From: Carlo Date: Tue, 15 Jul 2014 00:38:07 +0200 Subject: [ticket/12685] Add --safe-mode PHPBB3-12685 --- phpBB/phpbb/console/application.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php index 2aef48c93b..eac8dbea2d 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -67,6 +67,13 @@ class application extends \Symfony\Component\Console\Application $this->user->lang('CLI_DESCRIPTION_OPTION_SHELL') )); + $this->getDefinition()->addOption(new InputOption( + '--safe-mode', + null, + InputOption::VALUE_NONE, + $this->user->lang('CLI_DESCRIPTION_OPTION_SAFE_MODE') + )); + return parent::getHelp(); } -- cgit v1.2.1 From 0f41a8fc31ba6af38fc90f47b742ffe35815fd3b Mon Sep 17 00:00:00 2001 From: Carlo Date: Tue, 15 Jul 2014 10:21:23 +0200 Subject: [ticket/12685] Removed spaces PHPBB3-12685 --- phpBB/phpbb/console/application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php index eac8dbea2d..5cda90208a 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -72,7 +72,7 @@ class application extends \Symfony\Component\Console\Application null, InputOption::VALUE_NONE, $this->user->lang('CLI_DESCRIPTION_OPTION_SAFE_MODE') - )); + )); return parent::getHelp(); } -- cgit v1.2.1 From 15136e4f8e36ca972f6b1b0bb7a4867967698335 Mon Sep 17 00:00:00 2001 From: Carlo Date: Tue, 15 Jul 2014 11:36:51 +0200 Subject: [ticket/12685] Inject console.command_collection instead of the container PHPBB3-12685 --- phpBB/phpbb/console/application.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php index 5cda90208a..5202a1fbaf 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -80,11 +80,11 @@ class application extends \Symfony\Component\Console\Application /** * Register a set of commands from the container * - * @param ContainerInterface $container The container + * @param \phpbb\di\service_collection $command_collection The console service collection */ - public function register_container_commands(ContainerInterface $container) + public function register_container_commands(\phpbb\di\service_collection $command_collection) { - foreach ($container->get('console.command_collection') as $service_command) + foreach ($command_collection as $service_command) { $this->add($service_command); } -- cgit v1.2.1 From 3eafeeb88d173bc4f2b082ee5f09f85bef931ec9 Mon Sep 17 00:00:00 2001 From: Carlo Date: Tue, 15 Jul 2014 13:31:34 +0200 Subject: [ticket/12685] Removed unused USE statement PHPBB3-12685 --- phpBB/phpbb/console/application.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php index 5202a1fbaf..b08346b8fa 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -17,7 +17,6 @@ use Symfony\Component\Console\Shell; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; class application extends \Symfony\Component\Console\Application { -- cgit v1.2.1 From 7cffedf5e310e0cde9bfd541ca835a4fedf26ef3 Mon Sep 17 00:00:00 2001 From: Carlo Date: Tue, 15 Jul 2014 16:07:52 +0200 Subject: [ticket/12685] Override getDefaultInputDefinition() PHPBB3-12685 --- phpBB/phpbb/console/application.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/console/application.php b/phpBB/phpbb/console/application.php index b08346b8fa..bc4897af18 100644 --- a/phpBB/phpbb/console/application.php +++ b/phpBB/phpbb/console/application.php @@ -37,9 +37,26 @@ class application extends \Symfony\Component\Console\Application */ public function __construct($name, $version, \phpbb\user $user) { + $this->user = $user; + parent::__construct($name, $version); + } - $this->user = $user; + /** + * {@inheritdoc} + */ + protected function getDefaultInputDefinition() + { + $input_definition = parent::getDefaultInputDefinition(); + + $input_definition->addOption(new InputOption( + 'safe-mode', + null, + InputOption::VALUE_NONE, + $this->user->lang('CLI_DESCRIPTION_OPTION_SAFE_MODE') + )); + + return $input_definition; } /** @@ -66,13 +83,6 @@ class application extends \Symfony\Component\Console\Application $this->user->lang('CLI_DESCRIPTION_OPTION_SHELL') )); - $this->getDefinition()->addOption(new InputOption( - '--safe-mode', - null, - InputOption::VALUE_NONE, - $this->user->lang('CLI_DESCRIPTION_OPTION_SAFE_MODE') - )); - return parent::getHelp(); } -- cgit v1.2.1