mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 08:47:45 +02:00
[ticket/16649] Upgrade to Symfony 5
PHPBB3-16649
This commit is contained in:
5
phpBB/phpbb/console/command/cache/purge.php
vendored
5
phpBB/phpbb/console/command/cache/purge.php
vendored
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\cache;
|
||||
|
||||
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;
|
||||
@@ -72,7 +73,7 @@ class purge extends \phpbb\console\command\command
|
||||
* @param InputInterface $input An InputInterface instance
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*
|
||||
* @return void
|
||||
* @return int
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
@@ -87,5 +88,7 @@ class purge extends \phpbb\console\command\command
|
||||
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
$io->success($this->user->lang('PURGE_CACHE_SUCCESS'));
|
||||
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\config;
|
||||
|
||||
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;
|
||||
@@ -20,8 +21,8 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
class delete extends command
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
@@ -36,16 +37,16 @@ class delete extends command
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the command config:delete.
|
||||
*
|
||||
* Removes a configuration option
|
||||
*
|
||||
* @param InputInterface $input An InputInterface instance
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*
|
||||
* @return void
|
||||
* @see \phpbb\config\config::delete()
|
||||
*/
|
||||
* Executes the command config:delete.
|
||||
*
|
||||
* Removes a configuration option
|
||||
*
|
||||
* @param InputInterface $input An InputInterface instance
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*
|
||||
* @return int
|
||||
* @see \phpbb\config\config::delete()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
@@ -57,10 +58,13 @@ class delete extends command
|
||||
$this->config->delete($key);
|
||||
|
||||
$io->success($this->user->lang('CLI_CONFIG_DELETE_SUCCESS', $key));
|
||||
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
$io->error($this->user->lang('CLI_CONFIG_NOT_EXISTS', $key));
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\config;
|
||||
|
||||
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\Input\InputOption;
|
||||
@@ -50,7 +51,7 @@ class get extends command
|
||||
* @param InputInterface $input An InputInterface instance
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*
|
||||
* @return void
|
||||
* @return int
|
||||
* @see \phpbb\config\config::offsetGet()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
@@ -62,14 +63,17 @@ class get extends command
|
||||
if (isset($this->config[$key]) && $input->getOption('no-newline'))
|
||||
{
|
||||
$output->write($this->config[$key]);
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
else if (isset($this->config[$key]))
|
||||
{
|
||||
$output->writeln($this->config[$key]);
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
$io->error($this->user->lang('CLI_CONFIG_NOT_EXISTS', $key));
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\config;
|
||||
|
||||
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\Input\InputOption;
|
||||
@@ -55,7 +56,7 @@ class increment extends command
|
||||
* @param InputInterface $input An InputInterface instance
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*
|
||||
* @return void
|
||||
* @return int
|
||||
* @see \phpbb\config\config::increment()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
@@ -69,5 +70,7 @@ class increment extends command
|
||||
$this->config->increment($key, $increment, $use_cache);
|
||||
|
||||
$io->success($this->user->lang('CLI_CONFIG_INCREMENT_SUCCESS', $key));
|
||||
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\config;
|
||||
|
||||
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\Input\InputOption;
|
||||
@@ -55,7 +56,7 @@ class set extends command
|
||||
* @param InputInterface $input An InputInterface instance
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*
|
||||
* @return void
|
||||
* @return int
|
||||
* @see \phpbb\config\config::set()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
@@ -69,5 +70,7 @@ class set extends command
|
||||
$this->config->set($key, $value, $use_cache);
|
||||
|
||||
$io->success($this->user->lang('CLI_CONFIG_SET_SUCCESS', $key));
|
||||
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\config;
|
||||
|
||||
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\Input\InputOption;
|
||||
@@ -76,12 +77,12 @@ class set_atomic extends command
|
||||
if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache))
|
||||
{
|
||||
$io->success($this->user->lang('CLI_CONFIG_SET_SUCCESS', $key));
|
||||
return 0;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
$io->error($this->user->lang('CLI_CONFIG_SET_FAILURE', $key));
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\cron;
|
||||
|
||||
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;
|
||||
@@ -52,7 +53,7 @@ class cron_list extends \phpbb\console\command\command
|
||||
* @param InputInterface $input An InputInterface instance
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*
|
||||
* @return void
|
||||
* @return int
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
@@ -63,7 +64,7 @@ class cron_list extends \phpbb\console\command\command
|
||||
if (empty($tasks))
|
||||
{
|
||||
$io->error($this->user->lang('CRON_NO_TASKS'));
|
||||
return;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
$ready_tasks = $not_ready_tasks = array();
|
||||
@@ -90,5 +91,7 @@ class cron_list extends \phpbb\console\command\command
|
||||
$io->title($this->user->lang('TASKS_NOT_READY'));
|
||||
$io->listing($not_ready_tasks);
|
||||
}
|
||||
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\dev;
|
||||
|
||||
use Symfony\Component\Console\Command\Command as symfony_command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
@@ -26,6 +27,9 @@ class migration_tips extends \phpbb\console\command\command
|
||||
parent::__construct($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
@@ -34,6 +38,16 @@ class migration_tips extends \phpbb\console\command\command
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the command dev:migration-tips.
|
||||
*
|
||||
* Finds migrations that are not depended upon
|
||||
*
|
||||
* @param InputInterface $input An InputInterface instance
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$migrations = $this->extension_manager->get_finder()
|
||||
@@ -60,5 +74,7 @@ class migration_tips extends \phpbb\console\command\command
|
||||
$output->writeln("\t\t\t'{$migration}',");
|
||||
}
|
||||
$output->writeln("\t\t];");
|
||||
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@
|
||||
|
||||
namespace phpbb\console\command\fixup;
|
||||
|
||||
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;
|
||||
@@ -64,7 +65,7 @@ class fix_left_right_ids extends \phpbb\console\command\command
|
||||
* @param InputInterface $input An InputInterface instance
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
*
|
||||
* @return void
|
||||
* @return int
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
@@ -87,6 +88,7 @@ class fix_left_right_ids extends \phpbb\console\command\command
|
||||
$this->cache->purge();
|
||||
|
||||
$io->success($this->user->lang('CLI_FIXUP_FIX_LEFT_RIGHT_IDS_SUCCESS'));
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\fixup;
|
||||
|
||||
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\Helper\ProgressBar;
|
||||
@@ -114,5 +115,6 @@ class update_hashes extends \phpbb\console\command\command
|
||||
$progress_bar->finish();
|
||||
|
||||
$output->writeln('<info>' . $this->user->lang('CLI_FIXUP_UPDATE_HASH_BCRYPT_SUCCESS') . '</info>');
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@
|
||||
|
||||
namespace phpbb\console\command\reparser;
|
||||
|
||||
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;
|
||||
@@ -67,6 +68,6 @@ class list_all extends \phpbb\console\command\command
|
||||
$io->section($this->user->lang('CLI_DESCRIPTION_REPARSER_AVAILABLE'));
|
||||
$io->listing($this->reparser_names);
|
||||
|
||||
return 0;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@
|
||||
namespace phpbb\console\command\reparser;
|
||||
|
||||
use phpbb\exception\runtime_exception;
|
||||
use Symfony\Component\Console\Command\Command as symfony_command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
@@ -157,7 +158,7 @@ class reparse extends \phpbb\console\command\command
|
||||
|
||||
$this->reparse_lock->release();
|
||||
|
||||
return 0;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\thumbnail;
|
||||
|
||||
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;
|
||||
@@ -90,7 +91,7 @@ class delete extends \phpbb\console\command\command
|
||||
if ($nb_missing_thumbnails === 0)
|
||||
{
|
||||
$io->warning($this->user->lang('CLI_THUMBNAIL_NOTHING_TO_DELETE'));
|
||||
return 0;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
|
||||
$sql = 'SELECT attach_id, physical_filename, extension, real_filename, mimetype
|
||||
@@ -105,7 +106,7 @@ class delete extends \phpbb\console\command\command
|
||||
$progress->start();
|
||||
|
||||
$thumbnail_deleted = array();
|
||||
$return = 0;
|
||||
$return = symfony_command::SUCCESS;
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
$thumbnail_path = $this->phpbb_root_path . $this->config['upload_path'] . '/thumb_' . $row['physical_filename'];
|
||||
@@ -124,7 +125,7 @@ class delete extends \phpbb\console\command\command
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = 1;
|
||||
$return = symfony_command::FAILURE;
|
||||
$progress->setMessage('<error>' . $this->user->lang('CLI_THUMBNAIL_SKIPPED', $row['real_filename'], $row['physical_filename']) . '</error>');
|
||||
}
|
||||
|
||||
|
@@ -13,6 +13,7 @@
|
||||
|
||||
namespace phpbb\console\command\thumbnail;
|
||||
|
||||
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;
|
||||
@@ -107,7 +108,7 @@ class generate extends \phpbb\console\command\command
|
||||
if ($nb_missing_thumbnails === 0)
|
||||
{
|
||||
$io->warning($this->user->lang('CLI_THUMBNAIL_NOTHING_TO_GENERATE'));
|
||||
return 0;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
|
||||
$extensions = $this->cache->obtain_attach_extensions(true);
|
||||
@@ -168,7 +169,7 @@ class generate extends \phpbb\console\command\command
|
||||
$io->newLine(2);
|
||||
$io->success($this->user->lang('CLI_THUMBNAIL_GENERATING_DONE'));
|
||||
|
||||
return 0;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
namespace phpbb\console\command\thumbnail;
|
||||
|
||||
use Symfony\Component\Console\Command\Command as symfony_command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@@ -57,7 +58,7 @@ class recreate extends \phpbb\console\command\command
|
||||
$input_delete = new ArrayInput($parameters);
|
||||
$return = $this->getApplication()->run($input_delete, $output);
|
||||
|
||||
if ($return === 0)
|
||||
if ($return === symfony_command::SUCCESS)
|
||||
{
|
||||
$parameters['command'] = 'thumbnail:generate';
|
||||
|
||||
|
@@ -17,6 +17,7 @@ use phpbb\config\config;
|
||||
use phpbb\exception\exception_interface;
|
||||
use phpbb\language\language;
|
||||
use phpbb\user;
|
||||
use Symfony\Component\Console\Command\Command as symfony_command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
@@ -155,7 +156,7 @@ class check extends \phpbb\console\command\command
|
||||
$this->display_versions($io, $updates_available);
|
||||
}
|
||||
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -164,14 +165,14 @@ class check extends \phpbb\console\command\command
|
||||
$io->success($this->language->lang('UPDATE_NOT_NEEDED'));
|
||||
}
|
||||
|
||||
return 0;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
catch (\RuntimeException $e)
|
||||
{
|
||||
$io->error($this->language->lang('EXTENSION_NOT_INSTALLED', $ext_name));
|
||||
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +208,7 @@ class check extends \phpbb\console\command\command
|
||||
$this->display_versions($io, $updates_available);
|
||||
}
|
||||
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -216,7 +217,7 @@ class check extends \phpbb\console\command\command
|
||||
$io->success($this->language->lang('UPDATE_NOT_NEEDED'));
|
||||
}
|
||||
|
||||
return 0;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +293,7 @@ class check extends \phpbb\console\command\command
|
||||
$this->language->lang('LATEST_VERSION'),
|
||||
], $rows);
|
||||
|
||||
return 0;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -20,6 +20,7 @@ use phpbb\log\log_interface;
|
||||
use phpbb\notification\manager;
|
||||
use phpbb\user;
|
||||
use phpbb\user_loader;
|
||||
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\Input\InputOption;
|
||||
@@ -137,19 +138,19 @@ class activate extends command
|
||||
if ($user_row['user_id'] == ANONYMOUS)
|
||||
{
|
||||
$io->error($this->language->lang('NO_USER'));
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
// Check if the user is already active (or inactive)
|
||||
if ($mode == 'activate' && $user_row['user_type'] != USER_INACTIVE)
|
||||
{
|
||||
$io->error($this->language->lang('CLI_DESCRIPTION_USER_ACTIVATE_ACTIVE'));
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
else if ($mode == 'deactivate' && $user_row['user_type'] == USER_INACTIVE)
|
||||
{
|
||||
$io->error($this->language->lang('CLI_DESCRIPTION_USER_ACTIVATE_INACTIVE'));
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
// Activate the user account
|
||||
@@ -177,7 +178,7 @@ class activate extends command
|
||||
|
||||
$io->success($this->language->lang($msg));
|
||||
|
||||
return 0;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -20,6 +20,7 @@ use phpbb\exception\runtime_exception;
|
||||
use phpbb\language\language;
|
||||
use phpbb\passwords\manager;
|
||||
use phpbb\user;
|
||||
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;
|
||||
@@ -142,7 +143,7 @@ class add extends command
|
||||
catch (runtime_exception $e)
|
||||
{
|
||||
$io->error($e->getMessage());
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
$user_row = array(
|
||||
@@ -161,7 +162,7 @@ class add extends command
|
||||
if (!$user_id)
|
||||
{
|
||||
$io->error($this->language->lang('AUTH_NO_PROFILE_CREATED'));
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
if ($input->getOption('send-email') && $this->config['email_enable'])
|
||||
@@ -171,7 +172,7 @@ class add extends command
|
||||
|
||||
$io->success($this->language->lang('CLI_USER_ADD_SUCCESS', $this->data['username']));
|
||||
|
||||
return 0;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -18,6 +18,7 @@ use phpbb\language\language;
|
||||
use phpbb\log\log_interface;
|
||||
use phpbb\user;
|
||||
use phpbb\user_loader;
|
||||
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\Input\InputOption;
|
||||
@@ -122,7 +123,7 @@ class delete extends command
|
||||
if ($user_row['user_id'] == ANONYMOUS)
|
||||
{
|
||||
$io->error($this->language->lang('NO_USER'));
|
||||
return 1;
|
||||
return symfony_command::FAILURE;
|
||||
}
|
||||
|
||||
if (!function_exists('user_delete'))
|
||||
@@ -137,7 +138,7 @@ class delete extends command
|
||||
$io->success($this->language->lang('USER_DELETED'));
|
||||
}
|
||||
|
||||
return 0;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -17,6 +17,7 @@ use phpbb\console\command\command;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\language\language;
|
||||
use phpbb\user;
|
||||
use Symfony\Component\Console\Command\Command as symfony_command;
|
||||
use Symfony\Component\Console\Helper\ProgressBar;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
@@ -98,7 +99,7 @@ class reclean extends command
|
||||
$io->newLine(2);
|
||||
$io->success($this->language->lang('CLI_USER_RECLEAN_DONE', $this->processed));
|
||||
|
||||
return 0;
|
||||
return symfony_command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user