diff options
Diffstat (limited to 'phpBB/phpbb/console/command')
18 files changed, 83 insertions, 84 deletions
| diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index 379d2aa1ca..ec8229200c 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -29,31 +29,27 @@ class purge extends \phpbb\console\command\command  	/** @var \phpbb\log\log */  	protected $log; -	/** @var \phpbb\user */ -	protected $user; -  	/** @var \phpbb\config\config */  	protected $config;  	/**  	* Constructor  	* +	* @param \phpbb\user							$user	User instance  	* @param \phpbb\cache\driver\driver_interface	$cache	Cache instance  	* @param \phpbb\db\driver\driver_interface		$db		Database connection  	* @param \phpbb\auth\auth						$auth	Auth instance  	* @param \phpbb\log\log							$log	Logger instance -	* @param \phpbb\user							$user	User instance  	* @param \phpbb\config\config					$config	Config instance  	*/ -	public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\user $user, \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 $log, \phpbb\config\config $config)  	{  		$this->cache = $cache;  		$this->db = $db;  		$this->auth = $auth;  		$this->log = $log; -		$this->user = $user;  		$this->config = $config; -		parent::__construct(); +		parent::__construct($user);  	}  	/** @@ -63,7 +59,7 @@ class purge extends \phpbb\console\command\command  	{  		$this  			->setName('cache:purge') -			->setDescription('Purge the cache.') +			->setDescription($this->user->lang('PURGE_CACHE'))  		;  	} diff --git a/phpBB/phpbb/console/command/command.php b/phpBB/phpbb/console/command/command.php index d3449c0c38..638c989da2 100644 --- a/phpBB/phpbb/console/command/command.php +++ b/phpBB/phpbb/console/command/command.php @@ -15,4 +15,17 @@ namespace phpbb\console\command;  abstract class command extends \Symfony\Component\Console\Command\Command  { +	/** @var \phpbb\user */ +	protected $user; + +	/** +	* Constructor +	* +	* @param \phpbb\user $user User instance (mostly for translation) +	*/ +	public function __construct(\phpbb\user $user) +	{ +		$this->user = $user; +		parent::__construct(); +	}  } diff --git a/phpBB/phpbb/console/command/config/command.php b/phpBB/phpbb/console/command/config/command.php index de3fbd7fa7..f0ad5d4d19 100644 --- a/phpBB/phpbb/console/command/config/command.php +++ b/phpBB/phpbb/console/command/config/command.php @@ -17,10 +17,10 @@ abstract class command extends \phpbb\console\command\command  	/** @var \phpbb\config\config */  	protected $config; -	function __construct(\phpbb\config\config $config) +	function __construct(\phpbb\user $user, \phpbb\config\config $config)  	{  		$this->config = $config; -		parent::__construct(); +		parent::__construct($user);  	}  } diff --git a/phpBB/phpbb/console/command/config/delete.php b/phpBB/phpbb/console/command/config/delete.php index 1310bb18b4..efd276d7e3 100644 --- a/phpBB/phpbb/console/command/config/delete.php +++ b/phpBB/phpbb/console/command/config/delete.php @@ -25,11 +25,11 @@ class delete extends command  	{  		$this  			->setName('config:delete') -			->setDescription('Deletes a configuration option') +			->setDescription($this->user->lang('CLI_DESCRIPTION_DELETE_CONFIG'))  			->addArgument(  				'key',  				InputArgument::REQUIRED, -				"The configuration option's name" +				$this->user->lang('CLI_CONFIG_OPTION_NAME')  			)  		;  	} @@ -53,11 +53,11 @@ class delete extends command  		{  			$this->config->delete($key); -			$output->writeln("<info>Successfully deleted config $key</info>"); +			$output->writeln('<info>' . $this->user->lang('CLI_CONFIG_DELETE_SUCCESS', $key) . '</info>');  		}  		else  		{ -			$output->writeln("<error>Config $key does not exist</error>"); +			$output->writeln('<error>' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '</error>');  		}  	}  } diff --git a/phpBB/phpbb/console/command/config/get.php b/phpBB/phpbb/console/command/config/get.php index ee8c65110e..9c03b49a3d 100644 --- a/phpBB/phpbb/console/command/config/get.php +++ b/phpBB/phpbb/console/command/config/get.php @@ -26,17 +26,17 @@ class get extends command  	{  		$this  			->setName('config:get') -			->setDescription("Gets a configuration option's value") +			->setDescription($this->user->lang('CLI_DESCRIPTION_GET_CONFIG'))  			->addArgument(  				'key',  				InputArgument::REQUIRED, -				"The configuration option's name" +				$this->user->lang('CLI_CONFIG_OPTION_NAME')  			)  			->addOption(  				'no-newline',  				null,  				InputOption::VALUE_NONE, -				'Set this option if the value should be printed without a new line at the end.' +				$this->user->lang('CLI_CONFIG_PRINT_WITHOUT_NEWLINE')  			)  		;  	} @@ -66,7 +66,7 @@ class get extends command  		}  		else  		{ -			$output->writeln("<error>Could not get config $key</error>"); +			$output->writeln('<error>' . $this->user->lang('CLI_CONFIG_NOT_EXISTS', $key) . '</error>');  		}  	}  } diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php index 21f0660e61..b4d7438b66 100644 --- a/phpBB/phpbb/console/command/config/increment.php +++ b/phpBB/phpbb/console/command/config/increment.php @@ -26,22 +26,22 @@ class increment extends command  	{  		$this  			->setName('config:increment') -			->setDescription("Increments a configuration option's value") +			->setDescription($this->user->lang('CLI_DESCRIPTION_INCREMENT_CONFIG'))  			->addArgument(  				'key',  				InputArgument::REQUIRED, -				"The configuration option's name" +				$this->user->lang('CLI_CONFIG_OPTION_NAME')  			)  			->addArgument(  				'increment',  				InputArgument::REQUIRED, -				'Amount to increment by' +				$this->user->lang('CLI_CONFIG_INCREMENT_BY')  			)  			->addOption(  				'dynamic',  				'd',  				InputOption::VALUE_NONE, -				'Set this option if the configuration option changes too frequently to be efficiently cached.' +				$this->user->lang('CLI_CONFIG_CANNOT_CACHED')  			)  		;  	} @@ -65,6 +65,6 @@ class increment extends command  		$this->config->increment($key, $increment, $use_cache); -		$output->writeln("<info>Successfully incremented config $key</info>"); +		$output->writeln('<info>' . $this->user->lang('CLI_CONFIG_INCREMENT_SUCCESS', $key) . '</info>');  	}  } diff --git a/phpBB/phpbb/console/command/config/set.php b/phpBB/phpbb/console/command/config/set.php index 587b7fb0de..695de31013 100644 --- a/phpBB/phpbb/console/command/config/set.php +++ b/phpBB/phpbb/console/command/config/set.php @@ -26,22 +26,22 @@ class set extends command  	{  		$this  			->setName('config:set') -			->setDescription("Sets a configuration option's value") +			->setDescription($this->user->lang('CLI_DESCRIPTION_SET_CONFIG'))  			->addArgument(  				'key',  				InputArgument::REQUIRED, -				"The configuration option's name" +				$this->user->lang('CLI_CONFIG_OPTION_NAME')  			)  			->addArgument(  				'value',  				InputArgument::REQUIRED, -				'New configuration value, use 0 and 1 to specify boolean values' +				$this->user->lang('CLI_CONFIG_NEW')  			)  			->addOption(  				'dynamic',  				'd',  				InputOption::VALUE_NONE, -				'Set this option if the configuration option changes too frequently to be efficiently cached.' +				$this->user->lang('CLI_CONFIG_CANNOT_CACHED')  			)  		;  	} @@ -65,6 +65,6 @@ class set extends command  		$this->config->set($key, $value, $use_cache); -		$output->writeln("<info>Successfully set config $key</info>"); +		$output->writeln('<info>' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . '</info>');  	}  } diff --git a/phpBB/phpbb/console/command/config/set_atomic.php b/phpBB/phpbb/console/command/config/set_atomic.php index a7a52155f9..e8c69a0885 100644 --- a/phpBB/phpbb/console/command/config/set_atomic.php +++ b/phpBB/phpbb/console/command/config/set_atomic.php @@ -26,27 +26,27 @@ class set_atomic extends command  	{  		$this  			->setName('config:set-atomic') -			->setDescription("Sets a configuration option's value only if the old matches the current value.") +			->setDescription($this->user->lang('CLI_DESCRIPTION_SET_ATOMIC_CONFIG'))  			->addArgument(  				'key',  				InputArgument::REQUIRED, -				"The configuration option's name" +				$this->user->lang('CLI_CONFIG_OPTION_NAME')  			)  			->addArgument(  				'old',  				InputArgument::REQUIRED, -				'Current configuration value, use 0 and 1 to specify boolean values' +				$this->user->lang('CLI_CONFIG_CURRENT')  			)  			->addArgument(  				'new',  				InputArgument::REQUIRED, -				'New configuration value, use 0 and 1 to specify boolean values' +				$this->user->lang('CLI_CONFIG_NEW')  			)  			->addOption(  				'dynamic',  				'd',  				InputOption::VALUE_NONE, -				'Set this option if the configuration option changes too frequently to be efficiently cached.' +				$this->user->lang('CLI_CONFIG_CANNOT_CACHED')  			)  		;  	} @@ -72,12 +72,12 @@ class set_atomic extends command  		if ($this->config->set_atomic($key, $old_value, $new_value, $use_cache))  		{ -			$output->writeln("<info>Successfully set config $key</info>"); +			$output->writeln('<info>' . $this->user->lang('CLI_CONFIG_SET_SUCCESS', $key) . '</info>');  			return 0;  		}  		else  		{ -			$output->writeln("<error>Could not set config $key</error>"); +			$output->writeln('<error>' . $this->user->lang('CLI_CONFIG_SET_FAILURE', $key) . '</error>');  			return 1;  		}  	} diff --git a/phpBB/phpbb/console/command/cron/cron_list.php b/phpBB/phpbb/console/command/cron/cron_list.php index 4f4228d9b3..c515fd9e80 100644 --- a/phpBB/phpbb/console/command/cron/cron_list.php +++ b/phpBB/phpbb/console/command/cron/cron_list.php @@ -20,20 +20,16 @@ class cron_list extends \phpbb\console\command\command  	/** @var \phpbb\cron\manager */  	protected $cron_manager; -	/** @var \phpbb\user */ -	protected $user; -  	/**  	* Constructor  	* -	* @param \phpbb\cron\manager	$cron_manager	Cron manager  	* @param \phpbb\user			$user			User instance +	* @param \phpbb\cron\manager	$cron_manager	Cron manager  	*/ -	public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\user $user) +	public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager)  	{  		$this->cron_manager = $cron_manager; -		$this->user = $user; -		parent::__construct(); +		parent::__construct($user);  	}  	/** diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php index 32774bebe4..72ad1205ef 100644 --- a/phpBB/phpbb/console/command/cron/run.php +++ b/phpBB/phpbb/console/command/cron/run.php @@ -3,7 +3,7 @@  *  * This file is part of the phpBB Forum Software package.  * -* @copyright (c) phpBB Limited +* @copyright (c) phpBB Limited <https://www.phpbb.com>  * @license GNU General Public License, version 2 (GPL-2.0)  *  * For full copyright and license information, please see @@ -25,23 +25,19 @@ class run extends \phpbb\console\command\command  	/** @var \phpbb\lock\db */  	protected $lock_db; -	/** @var \phpbb\user */ -	protected $user; -  	/**  	* Construct method  	* +	* @param \phpbb\user $user The user object (used to get language information)  	* @param \phpbb\cron\manager $cron_manager The cron manager containing  	*		the cron tasks to be executed.  	* @param \phpbb\lock\db $lock_db The lock for accessing database. -	* @param \phpbb\user $user The user object (used to get language information)  	*/ -	public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db, \phpbb\user $user) +	public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db)  	{  		$this->cron_manager = $cron_manager;  		$this->lock_db = $lock_db; -		$this->user = $user; -		parent::__construct(); +		parent::__construct($user);  	}  	/** diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 2abeaf5268..c3caae5f70 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -32,31 +32,29 @@ class migrate extends \phpbb\console\command\command  	/** @var \phpbb\log\log */  	protected $log; -	/** @var \phpbb\user */ -	protected $user; - -	function __construct(\phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log, \phpbb\user $user) +	function __construct(\phpbb\user $user, \phpbb\db\migrator $migrator, \phpbb\extension\manager $extension_manager, \phpbb\config\config $config, \phpbb\cache\service $cache, \phpbb\log\log $log)  	{  		$this->migrator = $migrator;  		$this->extension_manager = $extension_manager;  		$this->config = $config;  		$this->cache = $cache;  		$this->log = $log; -		$this->user = $user; +		parent::__construct($user);  		$this->user->add_lang(array('common', 'install', 'migrator')); -		parent::__construct();  	}  	protected function configure()  	{  		$this  			->setName('db:migrate') -			->setDescription('Updates the database by applying migrations.') +			->setDescription($this->user->lang('CLI_DESCRIPTION_DB_MIGRATE'))  		;  	}  	protected function execute(InputInterface $input, OutputInterface $output)  	{ +		$this->migrator->create_migrations_table(); +  		$this->load_migrations();  		$orig_version = $this->config['version'];  		while (!$this->migrator->finished()) diff --git a/phpBB/phpbb/console/command/dev/migration_tips.php b/phpBB/phpbb/console/command/dev/migration_tips.php index c2f61568ea..f9047bdac8 100644 --- a/phpBB/phpbb/console/command/dev/migration_tips.php +++ b/phpBB/phpbb/console/command/dev/migration_tips.php @@ -20,17 +20,17 @@ class migration_tips extends \phpbb\console\command\command  	/** @var \phpbb\extension\manager */  	protected $extension_manager; -	function __construct(\phpbb\extension\manager $extension_manager) +	function __construct(\phpbb\user $user, \phpbb\extension\manager $extension_manager)  	{  		$this->extension_manager = $extension_manager; -		parent::__construct(); +		parent::__construct($user);  	}  	protected function configure()  	{  		$this  			->setName('dev:migration-tips') -			->setDescription('Finds migrations that are not depended on.') +			->setDescription($this->user->lang('CLI_DESCRIPTION_FIND_MIGRATIONS'))  		;  	} diff --git a/phpBB/phpbb/console/command/extension/command.php b/phpBB/phpbb/console/command/extension/command.php index 21bb640504..364d954082 100644 --- a/phpBB/phpbb/console/command/extension/command.php +++ b/phpBB/phpbb/console/command/extension/command.php @@ -20,11 +20,11 @@ abstract class command extends \phpbb\console\command\command  	/** @var \phpbb\log\log */  	protected $log; -	public function __construct(\phpbb\extension\manager $manager, \phpbb\log\log $log) +	public function __construct(\phpbb\user $user, \phpbb\extension\manager $manager, \phpbb\log\log $log)  	{  		$this->manager = $manager;  		$this->log = $log; -		parent::__construct(); +		parent::__construct($user);  	}  } diff --git a/phpBB/phpbb/console/command/extension/disable.php b/phpBB/phpbb/console/command/extension/disable.php index 5f0e74b984..1eee16cbd9 100644 --- a/phpBB/phpbb/console/command/extension/disable.php +++ b/phpBB/phpbb/console/command/extension/disable.php @@ -22,11 +22,11 @@ class disable extends command  	{  		$this  			->setName('extension:disable') -			->setDescription('Disables the specified extension.') +			->setDescription($this->user->lang('CLI_DESCRIPTION_DISABLE_EXTENSION'))  			->addArgument(  				'extension-name',  				InputArgument::REQUIRED, -				'Name of the extension' +				$this->user->lang('CLI_EXTENSION_NAME')  			)  		;  	} @@ -37,15 +37,15 @@ class disable extends command  		$this->manager->disable($name);  		$this->manager->load_extensions(); -		if ($this->manager->enabled($name)) +		if ($this->manager->is_enabled($name))  		{ -			$output->writeln("<error>Could not disable extension $name</error>"); +			$output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_DISABLE_FAILURE', $name) . '</error>');  			return 1;  		}  		else  		{  			$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_DISABLE', time(), array($name)); -			$output->writeln("<info>Successfully disabled extension $name</info>"); +			$output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_DISABLE_SUCCESS', $name) . '</info>');  			return 0;  		}  	} diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php index 0cdf26d4db..59ff11e9b7 100644 --- a/phpBB/phpbb/console/command/extension/enable.php +++ b/phpBB/phpbb/console/command/extension/enable.php @@ -22,11 +22,11 @@ class enable extends command  	{  		$this  			->setName('extension:enable') -			->setDescription('Enables the specified extension.') +			->setDescription($this->user->lang('CLI_DESCRIPTION_ENABLE_EXTENSION'))  			->addArgument(  				'extension-name',  				InputArgument::REQUIRED, -				'Name of the extension' +				$this->user->lang('CLI_EXTENSION_NAME')  			)  		;  	} @@ -37,15 +37,15 @@ class enable extends command  		$this->manager->enable($name);  		$this->manager->load_extensions(); -		if ($this->manager->enabled($name)) +		if ($this->manager->is_enabled($name))  		{ -			$this->log->add('admin', ANONYMOUS, '', 'LOG_EXTENSION_ENABLE', time(), array($name)); -			$output->writeln("<info>Successfully enabled extension $name</info>"); +			$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name)); +			$output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name) . '</info>');  			return 0;  		}  		else  		{ -			$output->writeln("<error>Could not enable extension $name</error>"); +			$output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name) . '</error>');  			return 1;  		}  	} diff --git a/phpBB/phpbb/console/command/extension/purge.php b/phpBB/phpbb/console/command/extension/purge.php index 4e57641d83..517e9a74c9 100644 --- a/phpBB/phpbb/console/command/extension/purge.php +++ b/phpBB/phpbb/console/command/extension/purge.php @@ -22,11 +22,11 @@ class purge extends command  	{  		$this  			->setName('extension:purge') -			->setDescription('Purges the specified extension.') +			->setDescription($this->user->lang('CLI_DESCRIPTION_PURGE_EXTENSION'))  			->addArgument(  				'extension-name',  				InputArgument::REQUIRED, -				'Name of the extension' +				$this->user->lang('CLI_EXTENSION_NAME')  			)  		;  	} @@ -37,15 +37,15 @@ class purge extends command  		$this->manager->purge($name);  		$this->manager->load_extensions(); -		if ($this->manager->enabled($name)) +		if ($this->manager->is_enabled($name))  		{ -			$output->writeln("<error>Could not purge extension $name</error>"); +			$output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_PURGE_FAILURE', $name) . '</error>');  			return 1;  		}  		else  		{  			$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_PURGE', time(), array($name)); -			$output->writeln("<info>Successfully purge extension $name</info>"); +			$output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_PURGE_SUCCESS', $name) . '</info>');  			return 0;  		}  	} diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php index 2db1c59e24..6ce9607098 100644 --- a/phpBB/phpbb/console/command/extension/show.php +++ b/phpBB/phpbb/console/command/extension/show.php @@ -21,7 +21,7 @@ class show extends command  	{  		$this  			->setName('extension:show') -			->setDescription('Lists all extensions in the database and on the filesystem.') +			->setDescription($this->user->lang('CLI_DESCRIPTION_LIST_EXTENSIONS'))  		;  	} @@ -32,7 +32,7 @@ class show extends command  		if (empty($all))  		{ -			$output->writeln('<comment>No extensions were found.</comment>'); +			$output->writeln('<comment>' . $this->user->lang('CLI_EXTENSION_NOT_FOUND') . '</comment>');  			return 3;  		} diff --git a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php index ec04da4267..ec4e1b0ee7 100644 --- a/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php +++ b/phpBB/phpbb/console/command/fixup/recalculate_email_hash.php @@ -20,18 +20,18 @@ class recalculate_email_hash extends \phpbb\console\command\command  	/** @var \phpbb\db\driver\driver_interface */  	protected $db; -	function __construct(\phpbb\db\driver\driver_interface $db) +	function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db)  	{  		$this->db = $db; -		parent::__construct(); +		parent::__construct($user);  	}  	protected function configure()  	{  		$this  			->setName('fixup:recalculate-email-hash') -			->setDescription('Recalculates the user_email_hash column of the users table.') +			->setDescription($this->user->lang('CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH'))  		;  	} @@ -70,6 +70,6 @@ class recalculate_email_hash extends \phpbb\console\command\command  		}  		$this->db->sql_freeresult($result); -		$output->writeln('<info>Successfully recalculated all email hashes.</info>'); +		$output->writeln('<info>' . $this->user->lang('CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS') . '</info>');  	}  } | 
