mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 05:18:52 +00:00
[ticket/11150] Makes composer output level configurable
PHPBB3-11150
This commit is contained in:
parent
972f3a7ff4
commit
9a836b5901
6 changed files with 55 additions and 20 deletions
|
@ -11,3 +11,7 @@ core:
|
||||||
debug: true
|
debug: true
|
||||||
auto_reload: true
|
auto_reload: true
|
||||||
enable_debug_extension: true
|
enable_debug_extension: true
|
||||||
|
|
||||||
|
extensions:
|
||||||
|
composer_debug: true
|
||||||
|
composer_verbose: true
|
||||||
|
|
|
@ -440,7 +440,7 @@ class acp_extensions
|
||||||
'warning' => new \Symfony\Component\Console\Formatter\OutputFormatterStyle('black', 'yellow')
|
'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
|
try
|
||||||
{
|
{
|
||||||
|
@ -479,7 +479,7 @@ class acp_extensions
|
||||||
'warning' => new \Symfony\Component\Console\Formatter\OutputFormatterStyle('black', 'yellow')
|
'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
|
try
|
||||||
{
|
{
|
||||||
|
@ -518,7 +518,7 @@ class acp_extensions
|
||||||
'warning' => new \Symfony\Component\Console\Formatter\OutputFormatterStyle('black', 'yellow')
|
'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
|
try
|
||||||
{
|
{
|
||||||
|
@ -557,7 +557,7 @@ class acp_extensions
|
||||||
'warning' => new \Symfony\Component\Console\Formatter\OutputFormatterStyle('black', 'yellow')
|
'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
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,11 +106,11 @@ class extension_manager extends manager
|
||||||
}
|
}
|
||||||
catch (\phpbb\exception\runtime_exception $e)
|
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)
|
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)
|
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 = [];
|
$this->enabled_extensions = [];
|
||||||
foreach ($packages as $package)
|
foreach ($packages as $package)
|
||||||
{
|
{
|
||||||
|
@ -135,11 +135,11 @@ class extension_manager extends manager
|
||||||
}
|
}
|
||||||
catch (\phpbb\exception\runtime_exception $e)
|
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)
|
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)
|
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)
|
foreach ($this->enabled_extensions as $package)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -158,11 +158,11 @@ class extension_manager extends manager
|
||||||
}
|
}
|
||||||
catch (\phpbb\exception\runtime_exception $e)
|
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)
|
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)
|
if ($this->purge_on_remove)
|
||||||
{
|
{
|
||||||
$io->writeError([['DISABLING_EXTENSIONS', [], 1]], true, 1);
|
$io->writeError([['DISABLING_EXTENSIONS', [], 1]], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($packages as $package)
|
foreach ($packages as $package)
|
||||||
|
@ -211,11 +211,11 @@ class extension_manager extends manager
|
||||||
}
|
}
|
||||||
catch (\phpbb\exception\runtime_exception $e)
|
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)
|
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))
|
if ($this->extension_manager->is_enabled($package))
|
||||||
{
|
{
|
||||||
$enabled = true;
|
$enabled = true;
|
||||||
$io->writeError([['DISABLING_EXTENSIONS', [], 1]], true, 1);
|
$io->writeError([['DISABLING_EXTENSIONS', [], 1]], true);
|
||||||
$this->extension_manager->disable($package);
|
$this->extension_manager->disable($package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ class extension_manager extends manager
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$io->writeError([['ENABLING_EXTENSIONS', [], 1]], true, 1);
|
$io->writeError([['ENABLING_EXTENSIONS', [], 1]], true);
|
||||||
$this->extension_manager->enable($package);
|
$this->extension_manager->enable($package);
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
|
|
|
@ -16,6 +16,9 @@ namespace phpbb\composer\io;
|
||||||
use phpbb\language\language;
|
use phpbb\language\language;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trait to translate the composer Output
|
||||||
|
*/
|
||||||
trait translate_composer_trait
|
trait translate_composer_trait
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -54,9 +57,13 @@ trait translate_composer_trait
|
||||||
$parameters = [];
|
$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);
|
$elements = explode(' ', $message);
|
||||||
$lang_key = 'COMPOSER_DELETING';
|
$lang_key = 'COMPOSER_DELETING';
|
||||||
|
@ -116,7 +123,11 @@ trait translate_composer_trait
|
||||||
|
|
||||||
$message = trim($this->strip_format($lang_key), "\n\r");
|
$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)
|
if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,6 +45,13 @@ class container_configuration implements ConfigurationInterface
|
||||||
->booleanNode('enable_debug_extension')->defaultValue(false)->end()
|
->booleanNode('enable_debug_extension')->defaultValue(false)->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
|
->arrayNode('extensions')
|
||||||
|
->addDefaultsIfNotSet()
|
||||||
|
->children()
|
||||||
|
->booleanNode('composer_debug')->defaultValue(false)->end()
|
||||||
|
->booleanNode('composer_verbose')->defaultValue(false)->end()
|
||||||
|
->end()
|
||||||
|
->end()
|
||||||
->end()
|
->end()
|
||||||
;
|
;
|
||||||
return $treeBuilder;
|
return $treeBuilder;
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace phpbb\di\extension;
|
||||||
|
|
||||||
use Symfony\Component\Config\FileLocator;
|
use Symfony\Component\Config\FileLocator;
|
||||||
use Symfony\Component\Config\Resource\FileResource;
|
use Symfony\Component\Config\Resource\FileResource;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||||
|
@ -92,6 +93,18 @@ class core extends Extension
|
||||||
$definition->addTag('twig.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
|
// Set the debug options
|
||||||
foreach ($config['debug'] as $name => $value)
|
foreach ($config['debug'] as $name => $value)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue