1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-07 01:06:48 +02:00

[ticket/16649] Upgrade to Symfony 5

PHPBB3-16649
This commit is contained in:
rxu
2020-12-01 13:10:45 +07:00
parent 7110b61df5
commit 19b12bf6ee
133 changed files with 524 additions and 190 deletions

View File

@@ -12,6 +12,7 @@
*/
namespace phpbb\console\command\extension;
use Symfony\Component\Console\Command\Command as symfony_command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -19,6 +20,9 @@ use Symfony\Component\Console\Style\SymfonyStyle;
class disable extends command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
@@ -32,6 +36,16 @@ class disable extends command
;
}
/**
* Executes the command extension:disable.
*
* Disables the specified extension
*
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
@@ -50,14 +64,14 @@ class disable extends command
if ($this->manager->is_enabled($name))
{
$io->error($this->user->lang('CLI_EXTENSION_DISABLE_FAILURE', $name));
return 1;
return symfony_command::FAILURE;
}
else
{
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_DISABLE', time(), array($name));
$this->check_apcu_cache($io);
$io->success($this->user->lang('CLI_EXTENSION_DISABLE_SUCCESS', $name));
return 0;
return symfony_command::SUCCESS;
}
}
}

View File

@@ -12,6 +12,7 @@
*/
namespace phpbb\console\command\extension;
use Symfony\Component\Console\Command\Command as symfony_command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -19,6 +20,9 @@ use Symfony\Component\Console\Style\SymfonyStyle;
class enable extends command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
@@ -32,6 +36,16 @@ class enable extends command
;
}
/**
* Executes the command extension:enable.
*
* Enables the specified extension
*
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
@@ -41,7 +55,7 @@ class enable extends command
if (!$this->manager->is_available($name))
{
$io->error($this->user->lang('CLI_EXTENSION_NOT_EXIST', $name));
return 1;
return symfony_command::FAILURE;
}
$extension = $this->manager->get_extension($name);
@@ -51,13 +65,13 @@ class enable extends command
$message = !empty($enableable) ? $enableable : $this->user->lang('CLI_EXTENSION_NOT_ENABLEABLE', $name);
$message = is_array($message) ? implode(PHP_EOL, $message) : $message;
$io->error($message);
return 1;
return symfony_command::FAILURE;
}
if ($this->manager->is_enabled($name))
{
$io->error($this->user->lang('CLI_EXTENSION_ENABLED', $name));
return 1;
return symfony_command::FAILURE;
}
$this->manager->enable($name);
@@ -68,12 +82,12 @@ class enable extends command
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name));
$this->check_apcu_cache($io);
$io->success($this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name));
return 0;
return symfony_command::SUCCESS;
}
else
{
$io->error($this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name));
return 1;
return symfony_command::FAILURE;
}
}
}

View File

@@ -16,6 +16,7 @@ namespace phpbb\console\command\extension;
use phpbb\composer\extension_manager;
use phpbb\composer\io\console_io;
use phpbb\language\language;
use Symfony\Component\Console\Command\Command as symfony_command;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -83,7 +84,7 @@ class install extends \phpbb\console\command\command
if (!$this->manager->check_requirements())
{
$io->error($this->language->lang('EXTENSIONS_COMPOSER_NOT_WRITABLE'));
return 1;
return symfony_command::FAILURE;
}
$composer_io = new console_io($input, $output, $this->getHelperSet(), $this->language);
@@ -98,6 +99,6 @@ class install extends \phpbb\console\command\command
$io->success($this->language->lang('EXTENSIONS_INSTALLED'));
return 0;
return symfony_command::SUCCESS;
}
}

View File

@@ -14,6 +14,7 @@
namespace phpbb\console\command\extension;
use phpbb\composer\manager_interface;
use Symfony\Component\Console\Command\Command as symfony_command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
@@ -68,6 +69,6 @@ class list_available extends \phpbb\console\command\command
$io->listing($extensions);
return 0;
return symfony_command::SUCCESS;
}
}

View File

@@ -17,6 +17,7 @@ use phpbb\composer\exception\managed_with_error_exception;
use phpbb\composer\io\console_io;
use phpbb\composer\manager_interface;
use phpbb\language\language;
use Symfony\Component\Console\Command\Command as symfony_command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -75,7 +76,7 @@ class manage extends \phpbb\console\command\command
if (!$this->manager->check_requirements())
{
$io->error($this->language->lang('EXTENSIONS_COMPOSER_NOT_WRITABLE'));
return 1;
return symfony_command::FAILURE;
}
$composer_io = new console_io($input, $output, $this->getHelperSet(), $this->language);
@@ -89,11 +90,11 @@ class manage extends \phpbb\console\command\command
catch (managed_with_error_exception $e)
{
$io->warning($this->language->lang_array($e->getMessage(), $e->get_parameters()));
return 1;
return symfony_command::FAILURE;
}
$io->success($this->language->lang('EXTENSION_MANAGED_SUCCESS', $extension));
return 0;
return symfony_command::SUCCESS;
}
}

View File

@@ -12,6 +12,7 @@
*/
namespace phpbb\console\command\extension;
use Symfony\Component\Console\Command\Command as symfony_command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -19,6 +20,9 @@ use Symfony\Component\Console\Style\SymfonyStyle;
class purge extends command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
@@ -32,6 +36,16 @@ class purge extends command
;
}
/**
* Executes the command extension:purge.
*
* Purges the specified extension
*
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
@@ -43,14 +57,14 @@ class purge extends command
if ($this->manager->is_enabled($name))
{
$io->error($this->user->lang('CLI_EXTENSION_PURGE_FAILURE', $name));
return 1;
return symfony_command::FAILURE;
}
else
{
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name));
$this->check_apcu_cache($io);
$io->success($this->user->lang('CLI_EXTENSION_PURGE_SUCCESS', $name));
return 0;
return symfony_command::SUCCESS;
}
}
}

View File

@@ -16,6 +16,7 @@ namespace phpbb\console\command\extension;
use phpbb\composer\extension_manager;
use phpbb\composer\io\console_io;
use phpbb\language\language;
use Symfony\Component\Console\Command\Command as symfony_command;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -83,7 +84,7 @@ class remove extends \phpbb\console\command\command
if (!$this->manager->check_requirements())
{
$io->error($this->language->lang('EXTENSIONS_COMPOSER_NOT_WRITABLE'));
return 1;
return symfony_command::FAILURE;
}
$composer_io = new console_io($input, $output, $this->getHelperSet(), $this->language);
@@ -98,6 +99,6 @@ class remove extends \phpbb\console\command\command
$io->success($this->language->lang('EXTENSIONS_REMOVED'));
return 0;
return symfony_command::SUCCESS;
}
}

View File

@@ -12,12 +12,16 @@
*/
namespace phpbb\console\command\extension;
use Symfony\Component\Console\Command\Command as symfony_command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class show extends command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
@@ -26,6 +30,16 @@ class show extends command
;
}
/**
* Executes the command extension:show.
*
* Lists all extensions in the database and on the filesystem
*
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
@@ -50,5 +64,7 @@ class show extends command
$purged = array_diff($all, $enabled, $disabled);
$io->section($this->user->lang('CLI_EXTENSIONS_AVAILABLE'));
$io->listing($purged);
return symfony_command::SUCCESS;
}
}

View File

@@ -16,6 +16,7 @@ namespace phpbb\console\command\extension;
use phpbb\composer\io\console_io;
use phpbb\composer\manager_interface;
use phpbb\language\language;
use Symfony\Component\Console\Command\Command as symfony_command;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -75,7 +76,7 @@ class update extends \phpbb\console\command\command
if (!$this->manager->check_requirements())
{
$io->error($this->language->lang('EXTENSIONS_COMPOSER_NOT_WRITABLE'));
return 1;
return symfony_command::FAILURE;
}
$composer_io = new console_io($input, $output, $this->getHelperSet(), $this->language);
@@ -85,6 +86,6 @@ class update extends \phpbb\console\command\command
$io->success($this->language->lang('EXTENSIONS_UPDATED'));
return 0;
return symfony_command::SUCCESS;
}
}