mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
[ticket/16649] Upgrade to Symfony 5
PHPBB3-16649
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\db;
|
||||
|
||||
use Symfony\Component\Console\Command\Command as symfony_command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@@ -19,6 +20,9 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class list_command extends \phpbb\console\command\db\migration_command
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
@@ -33,6 +37,16 @@ class list_command extends \phpbb\console\command\db\migration_command
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the command db:list.
|
||||
*
|
||||
* Lists all installed and available migrations
|
||||
*
|
||||
* @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);
|
||||
@@ -71,11 +85,13 @@ class list_command extends \phpbb\console\command\db\migration_command
|
||||
if (!empty($available))
|
||||
{
|
||||
$io->listing($available);
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
$io->text($this->user->lang('CLI_MIGRATIONS_EMPTY'));
|
||||
$io->newLine();
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\db;
|
||||
|
||||
use Symfony\Component\Console\Command\Command as symfony_command;
|
||||
use phpbb\db\output_handler\log_wrapper_migrator_output_handler;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@@ -41,6 +42,9 @@ class migrate extends \phpbb\console\command\db\migration_command
|
||||
$this->language->add_lang(array('common', 'install', 'migrator'));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
@@ -49,6 +53,16 @@ class migrate extends \phpbb\console\command\db\migration_command
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the command db:migrate.
|
||||
*
|
||||
* Updates the database by applying migrations
|
||||
*
|
||||
* @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);
|
||||
@@ -71,7 +85,7 @@ class migrate extends \phpbb\console\command\db\migration_command
|
||||
{
|
||||
$io->error($e->getLocalisedMessage($this->user));
|
||||
$this->finalise_update();
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,5 +96,6 @@ class migrate extends \phpbb\console\command\db\migration_command
|
||||
|
||||
$this->finalise_update();
|
||||
$io->success($this->language->lang('INLINE_UPDATE_SUCCESSFUL'));
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\db;
|
||||
|
||||
use Symfony\Component\Console\Command\Command as symfony_command;
|
||||
use phpbb\db\output_handler\log_wrapper_migrator_output_handler;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
@@ -20,6 +21,9 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class revert extends \phpbb\console\command\db\migrate
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
@@ -33,6 +37,16 @@ class revert extends \phpbb\console\command\db\migrate
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the command db:revert.
|
||||
*
|
||||
* Reverts a migration
|
||||
*
|
||||
* @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);
|
||||
@@ -46,12 +60,12 @@ class revert extends \phpbb\console\command\db\migrate
|
||||
if (!in_array($name, $this->load_migrations()))
|
||||
{
|
||||
$io->error($this->language->lang('MIGRATION_NOT_VALID', $name));
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
else if ($this->migrator->migration_state($name) === false)
|
||||
{
|
||||
$io->error($this->language->lang('MIGRATION_NOT_INSTALLED', $name));
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
try
|
||||
@@ -65,10 +79,11 @@ class revert extends \phpbb\console\command\db\migrate
|
||||
{
|
||||
$io->error($e->getLocalisedMessage($this->user));
|
||||
$this->finalise_update();
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
$this->finalise_update();
|
||||
$io->success($this->language->lang('INLINE_UPDATE_SUCCESSFUL'));
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user