mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/12685] Add console collection and fixing CLI
Added a commands service collection and removed CLI container PHPBB3-12685
This commit is contained in:
parent
0d6fe20372
commit
b95ab44028
2 changed files with 11 additions and 6 deletions
|
@ -1,4 +1,10 @@
|
||||||
services:
|
services:
|
||||||
|
console.command_collection:
|
||||||
|
class: phpbb\di\service_collection
|
||||||
|
arguments:
|
||||||
|
- @service_container
|
||||||
|
tags:
|
||||||
|
- { name: service_collection, tag: console.command }
|
||||||
console.command.cache.purge:
|
console.command.cache.purge:
|
||||||
class: phpbb\console\command\cache\purge
|
class: phpbb\console\command\cache\purge
|
||||||
arguments:
|
arguments:
|
||||||
|
|
|
@ -17,7 +17,7 @@ use Symfony\Component\Console\Shell;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\DependencyInjection\TaggedContainerInterface;
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
|
||||||
class application extends \Symfony\Component\Console\Application
|
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
|
* Register a set of commands from the container
|
||||||
*
|
*
|
||||||
* @param TaggedContainerInterface $container The container
|
* @param ContainerInterface $container The container
|
||||||
* @param string $tag The tag used to register the commands
|
|
||||||
*/
|
*/
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue