1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

Merge pull request #2576 from carlo94it/ticket/12685

[ticket/12685] New CLI container for load extensions

* carlo94it/ticket/12685:
  [ticket/12685] Setup class loader for extensions only if not in safe mode
  [ticket/12685] Replace getParameterOption with hasParameterOption
  [ticket/12685] Do not dump container
  [ticket/12685] Override getDefaultInputDefinition()
  [ticket/12685] Removed unused USE statement
  [ticket/12685] Inject console.command_collection instead of the container
  [ticket/12685] Add a new line
  [ticket/12685] Container is dumped by default
  [ticket/12685] Removed spaces
  [ticket/12685] Add --safe-mode
  [ticket/12685] We need extensions enabled
  [ticket/12685] Add space after foreach
  [ticket/12685] Add console collection and fixing CLI
This commit is contained in:
Tristan Darricau
2014-07-17 16:03:55 +02:00
4 changed files with 49 additions and 14 deletions

View File

@@ -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\TaggedContainerInterface;
class application extends \Symfony\Component\Console\Application
{
@@ -38,9 +37,26 @@ class application extends \Symfony\Component\Console\Application
*/
public function __construct($name, $version, \phpbb\user $user)
{
parent::__construct($name, $version);
$this->user = $user;
parent::__construct($name, $version);
}
/**
* {@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;
}
/**
@@ -73,14 +89,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 \phpbb\di\service_collection $command_collection The console service collection
*/
public function register_container_commands(TaggedContainerInterface $container, $tag = 'console.command')
public function register_container_commands(\phpbb\di\service_collection $command_collection)
{
foreach($container->findTaggedServiceIds($tag) as $id => $void)
foreach ($command_collection as $service_command)
{
$this->add($container->get($id));
$this->add($service_command);
}
}