diff --git a/phpBB/config/development/config.yml b/phpBB/config/development/config.yml index f39eb52e73..1e144d68d6 100644 --- a/phpBB/config/development/config.yml +++ b/phpBB/config/development/config.yml @@ -11,3 +11,7 @@ core: debug: true auto_reload: true enable_debug_extension: true + + extensions: + composer_debug: true + composer_verbose: true diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 79c51bfd70..15a9d74623 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -440,7 +440,7 @@ class acp_extensions 'warning' => new \Symfony\Component\Console\Formatter\OutputFormatterStyle('black', 'yellow') ]); - $composer_io = new \phpbb\composer\io\web_io($language, '', \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_VERBOSE, $formatter); + $composer_io = new \phpbb\composer\io\web_io($language, '', $phpbb_container->getParameter('extensions.composer.output'), $formatter); try { @@ -479,7 +479,7 @@ class acp_extensions 'warning' => new \Symfony\Component\Console\Formatter\OutputFormatterStyle('black', 'yellow') ]); - $composer_io = new \phpbb\composer\io\web_io($language, '', \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_VERBOSE, $formatter); + $composer_io = new \phpbb\composer\io\web_io($language, '', $phpbb_container->getParameter('extensions.composer.output'), $formatter); try { @@ -518,7 +518,7 @@ class acp_extensions 'warning' => new \Symfony\Component\Console\Formatter\OutputFormatterStyle('black', 'yellow') ]); - $composer_io = new \phpbb\composer\io\web_io($language, '', \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_VERBOSE, $formatter); + $composer_io = new \phpbb\composer\io\web_io($language, '', $phpbb_container->getParameter('extensions.composer.output'), $formatter); try { @@ -557,7 +557,7 @@ class acp_extensions 'warning' => new \Symfony\Component\Console\Formatter\OutputFormatterStyle('black', 'yellow') ]); - $composer_io = new \phpbb\composer\io\web_io($language, '', \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_VERBOSE, $formatter); + $composer_io = new \phpbb\composer\io\web_io($language, '', $phpbb_container->getParameter('extensions.composer.output'), $formatter); try { diff --git a/phpBB/phpbb/composer/extension_manager.php b/phpBB/phpbb/composer/extension_manager.php index a1f67c6681..7e148e0d54 100644 --- a/phpBB/phpbb/composer/extension_manager.php +++ b/phpBB/phpbb/composer/extension_manager.php @@ -106,11 +106,11 @@ class extension_manager extends manager } catch (\phpbb\exception\runtime_exception $e) { - $io->writeError([$e->getMessage(), $e->get_parameters()], true, 4); + $io->writeError([[$e->getMessage(), $e->get_parameters(), 4]], true); } catch (\Exception $e) { - $io->writeError($e->getMessage(), true, 4); + $io->writeError([[$e->getMessage(), [], 4]], true); } } } @@ -121,7 +121,7 @@ class extension_manager extends manager */ protected function pre_update(array $packages, IOInterface $io = null) { - $io->writeError([['DISABLING_EXTENSIONS', [], 1]], true, 1); + $io->writeError([['DISABLING_EXTENSIONS', [], 1]], true); $this->enabled_extensions = []; foreach ($packages as $package) { @@ -135,11 +135,11 @@ class extension_manager extends manager } catch (\phpbb\exception\runtime_exception $e) { - $io->writeError([$e->getMessage(), $e->get_parameters()], true, 4); + $io->writeError([[$e->getMessage(), $e->get_parameters(), 4]], true); } catch (\Exception $e) { - $io->writeError($e->getMessage(), true, 4); + $io->writeError([[$e->getMessage(), [], 4]], true); } } } @@ -149,7 +149,7 @@ class extension_manager extends manager */ protected function post_update(array $packages, IOInterface $io = null) { - $io->writeError([['ENABLING_EXTENSIONS', [], 1]], true, 1); + $io->writeError([['ENABLING_EXTENSIONS', [], 1]], true); foreach ($this->enabled_extensions as $package) { try @@ -158,11 +158,11 @@ class extension_manager extends manager } catch (\phpbb\exception\runtime_exception $e) { - $io->writeError([$e->getMessage(), $e->get_parameters()], true, 4); + $io->writeError([[$e->getMessage(), $e->get_parameters(), 4]], true); } catch (\Exception $e) { - $io->writeError($e->getMessage(), true, 4); + $io->writeError([[$e->getMessage(), [], 4]], true); } } } @@ -190,7 +190,7 @@ class extension_manager extends manager { if ($this->purge_on_remove) { - $io->writeError([['DISABLING_EXTENSIONS', [], 1]], true, 1); + $io->writeError([['DISABLING_EXTENSIONS', [], 1]], true); } foreach ($packages as $package) @@ -211,11 +211,11 @@ class extension_manager extends manager } catch (\phpbb\exception\runtime_exception $e) { - $io->writeError([$e->getMessage(), $e->get_parameters()], true, 4); + $io->writeError([[$e->getMessage(), $e->get_parameters(), 4]], true); } catch (\Exception $e) { - $io->writeError($e->getMessage(), true, 4); + $io->writeError([[$e->getMessage(), [], 4]], true); } } } @@ -239,7 +239,7 @@ class extension_manager extends manager if ($this->extension_manager->is_enabled($package)) { $enabled = true; - $io->writeError([['DISABLING_EXTENSIONS', [], 1]], true, 1); + $io->writeError([['DISABLING_EXTENSIONS', [], 1]], true); $this->extension_manager->disable($package); } @@ -274,7 +274,7 @@ class extension_manager extends manager { try { - $io->writeError([['ENABLING_EXTENSIONS', [], 1]], true, 1); + $io->writeError([['ENABLING_EXTENSIONS', [], 1]], true); $this->extension_manager->enable($package); } catch (\Exception $e) diff --git a/phpBB/phpbb/composer/io/translate_composer_trait.php b/phpBB/phpbb/composer/io/translate_composer_trait.php index 64f69263e9..fd06dd95ce 100644 --- a/phpBB/phpbb/composer/io/translate_composer_trait.php +++ b/phpBB/phpbb/composer/io/translate_composer_trait.php @@ -16,6 +16,9 @@ namespace phpbb\composer\io; use phpbb\language\language; use Symfony\Component\Console\Output\OutputInterface; +/** + * Trait to translate the composer Output + */ trait translate_composer_trait { /** @@ -54,9 +57,13 @@ trait translate_composer_trait $parameters = []; } - $message = trim($this->strip_format($message), "\n\r"); + $message = trim($this->strip_format($lang_key), "\n\r"); - if (strpos($message, 'Deleting ') === 0) + if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_DEBUG) + { + // Do nothing + } + else if (strpos($message, 'Deleting ') === 0) { $elements = explode(' ', $message); $lang_key = 'COMPOSER_DELETING'; @@ -116,7 +123,11 @@ trait translate_composer_trait $message = trim($this->strip_format($lang_key), "\n\r"); - if (strpos($message, ' Problem ') === 0) + if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_DEBUG) + { + // Do nothing + } + else if (strpos($message, ' Problem ') === 0) { if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) { diff --git a/phpBB/phpbb/di/extension/container_configuration.php b/phpBB/phpbb/di/extension/container_configuration.php index 4585d6509e..3870670ac0 100644 --- a/phpBB/phpbb/di/extension/container_configuration.php +++ b/phpBB/phpbb/di/extension/container_configuration.php @@ -45,6 +45,13 @@ class container_configuration implements ConfigurationInterface ->booleanNode('enable_debug_extension')->defaultValue(false)->end() ->end() ->end() + ->arrayNode('extensions') + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('composer_debug')->defaultValue(false)->end() + ->booleanNode('composer_verbose')->defaultValue(false)->end() + ->end() + ->end() ->end() ; return $treeBuilder; diff --git a/phpBB/phpbb/di/extension/core.php b/phpBB/phpbb/di/extension/core.php index 67150f0103..64c3dafcad 100644 --- a/phpBB/phpbb/di/extension/core.php +++ b/phpBB/phpbb/di/extension/core.php @@ -15,6 +15,7 @@ namespace phpbb\di\extension; use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\HttpKernel\DependencyInjection\Extension; @@ -92,6 +93,18 @@ class core extends Extension $definition->addTag('twig.extension'); } + $composer_output = OutputInterface::VERBOSITY_NORMAL; + if ($config['extensions']['composer_verbose']) + { + $composer_output = OutputInterface::VERBOSITY_VERBOSE; + } + if ($config['extensions']['composer_debug']) + { + $composer_output = OutputInterface::VERBOSITY_DEBUG; + } + + $container->setParameter('extensions.composer.output', $composer_output); + // Set the debug options foreach ($config['debug'] as $name => $value) {