[ticket/14895] Fix issues in CLI classes

PHPBB3-14895
This commit is contained in:
Matt Friedman 2016-12-08 14:25:09 -08:00
parent b17fa7dfa5
commit cbf6d71f68
13 changed files with 18 additions and 44 deletions

View file

@ -111,15 +111,7 @@ services:
console.command.db.revert: console.command.db.revert:
class: phpbb\console\command\db\revert class: phpbb\console\command\db\revert
arguments: parent: console.command.db.migrate
- '@user'
- '@language'
- '@migrator'
- '@ext.manager'
- '@config'
- '@cache'
- '@filesystem'
- '%core.root_path%'
tags: tags:
- { name: console.command } - { name: console.command }

View file

@ -40,7 +40,7 @@ class purge extends \phpbb\console\command\command
* @param \phpbb\cache\driver\driver_interface $cache Cache instance * @param \phpbb\cache\driver\driver_interface $cache Cache instance
* @param \phpbb\db\driver\driver_interface $db Database connection * @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\auth\auth $auth Auth instance * @param \phpbb\auth\auth $auth Auth instance
* @param \phpbb\log\log $log Logger instance * @param \phpbb\log\log_interface $log Logger instance
* @param \phpbb\config\config $config Config instance * @param \phpbb\config\config $config Config instance
*/ */
public function __construct(\phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log_interface $log, \phpbb\config\config $config) public function __construct(\phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log_interface $log, \phpbb\config\config $config)
@ -72,7 +72,7 @@ class purge extends \phpbb\console\command\command
* @param InputInterface $input An InputInterface instance * @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance * @param OutputInterface $output An OutputInterface instance
* *
* @return null * @return void
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {

View file

@ -17,7 +17,7 @@ abstract class command extends \phpbb\console\command\command
/** @var \phpbb\config\config */ /** @var \phpbb\config\config */
protected $config; protected $config;
function __construct(\phpbb\user $user, \phpbb\config\config $config) public function __construct(\phpbb\user $user, \phpbb\config\config $config)
{ {
$this->config = $config; $this->config = $config;

View file

@ -43,7 +43,7 @@ class delete extends command
* @param InputInterface $input An InputInterface instance * @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance * @param OutputInterface $output An OutputInterface instance
* *
* @return null * @return void
* @see \phpbb\config\config::delete() * @see \phpbb\config\config::delete()
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)

View file

@ -50,7 +50,7 @@ class get extends command
* @param InputInterface $input An InputInterface instance * @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance * @param OutputInterface $output An OutputInterface instance
* *
* @return null * @return void
* @see \phpbb\config\config::offsetGet() * @see \phpbb\config\config::offsetGet()
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)

View file

@ -55,7 +55,7 @@ class increment extends command
* @param InputInterface $input An InputInterface instance * @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance * @param OutputInterface $output An OutputInterface instance
* *
* @return null * @return void
* @see \phpbb\config\config::increment() * @see \phpbb\config\config::increment()
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)

View file

@ -55,7 +55,7 @@ class set extends command
* @param InputInterface $input An InputInterface instance * @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance * @param OutputInterface $output An OutputInterface instance
* *
* @return null * @return void
* @see \phpbb\config\config::set() * @see \phpbb\config\config::set()
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)

View file

@ -52,7 +52,7 @@ class cron_list extends \phpbb\console\command\command
* @param InputInterface $input An InputInterface instance * @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance * @param OutputInterface $output An OutputInterface instance
* *
* @return null * @return void
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {

View file

@ -31,21 +31,21 @@ class migrate extends \phpbb\console\command\db\migration_command
/** @var \phpbb\language\language */ /** @var \phpbb\language\language */
protected $language; protected $language;
function __construct(\phpbb\user $user, \phpbb\language\language $language, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path) public function __construct(\phpbb\user $user, \phpbb\language\language $language, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path)
{ {
$this->language = $language; $this->language = $language;
$this->log = $log; $this->log = $log;
$this->filesystem = $filesystem; $this->filesystem = $filesystem;
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
parent::__construct($user, $migrator, $extension_manager, $config, $cache); parent::__construct($user, $migrator, $extension_manager, $config, $cache);
$this->user->add_lang(array('common', 'install', 'migrator')); $this->language->add_lang(array('common', 'install', 'migrator'));
} }
protected function configure() protected function configure()
{ {
$this $this
->setName('db:migrate') ->setName('db:migrate')
->setDescription($this->user->lang('CLI_DESCRIPTION_DB_MIGRATE')) ->setDescription($this->language->lang('CLI_DESCRIPTION_DB_MIGRATE'))
; ;
} }

View file

@ -26,7 +26,7 @@ abstract class migration_command extends \phpbb\console\command\command
/** @var \phpbb\cache\service */ /** @var \phpbb\cache\service */
protected $cache; protected $cache;
function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache) public function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache)
{ {
$this->migrator = $migrator; $this->migrator = $migrator;
$this->extension_manager = $extension_manager; $this->extension_manager = $extension_manager;

View file

@ -18,35 +18,17 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
class revert extends \phpbb\console\command\db\migration_command class revert extends \phpbb\console\command\db\migrate
{ {
/** @var string phpBB root path */
protected $phpbb_root_path;
/** @var \phpbb\filesystem\filesystem_interface */
protected $filesystem;
/** @var \phpbb\language\language */
protected $language;
function __construct(\phpbb\user $user, \phpbb\language\language $language, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path)
{
$this->filesystem = $filesystem;
$this->language = $language;
$this->phpbb_root_path = $phpbb_root_path;
parent::__construct($user, $migrator, $extension_manager, $config, $cache);
$this->user->add_lang(array('common', 'migrator'));
}
protected function configure() protected function configure()
{ {
$this $this
->setName('db:revert') ->setName('db:revert')
->setDescription($this->user->lang('CLI_DESCRIPTION_DB_REVERT')) ->setDescription($this->language->lang('CLI_DESCRIPTION_DB_REVERT'))
->addArgument( ->addArgument(
'name', 'name',
InputArgument::REQUIRED, InputArgument::REQUIRED,
$this->user->lang('CLI_MIGRATION_NAME') $this->language->lang('CLI_MIGRATION_NAME')
) )
; ;
} }

View file

@ -20,7 +20,7 @@ class migration_tips extends \phpbb\console\command\command
/** @var \phpbb\extension\manager */ /** @var \phpbb\extension\manager */
protected $extension_manager; protected $extension_manager;
function __construct(\phpbb\user $user, \phpbb\extension\manager $extension_manager) public function __construct(\phpbb\user $user, \phpbb\extension\manager $extension_manager)
{ {
$this->extension_manager = $extension_manager; $this->extension_manager = $extension_manager;
parent::__construct($user); parent::__construct($user);

View file

@ -21,7 +21,7 @@ class recalculate_email_hash extends \phpbb\console\command\command
/** @var \phpbb\db\driver\driver_interface */ /** @var \phpbb\db\driver\driver_interface */
protected $db; protected $db;
function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db) public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db)
{ {
$this->db = $db; $this->db = $db;