From 98ab5478e6a74b4325f002c1a5daae9d6dbe80e1 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 12 Jun 2014 14:20:58 +0200 Subject: [ticket/12692] Add a console command to manage the thumbnails PHPBB3-12692 --- phpBB/phpbb/console/command/thumbnail/recreate.php | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 phpBB/phpbb/console/command/thumbnail/recreate.php (limited to 'phpBB/phpbb/console/command/thumbnail/recreate.php') diff --git a/phpBB/phpbb/console/command/thumbnail/recreate.php b/phpBB/phpbb/console/command/thumbnail/recreate.php new file mode 100644 index 0000000000..569642f2a4 --- /dev/null +++ b/phpBB/phpbb/console/command/thumbnail/recreate.php @@ -0,0 +1,84 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\thumbnail; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Output\OutputInterface; + +class recreate extends \phpbb\console\command\command +{ + /** @var \phpbb\user */ + protected $user; + + /** + * Constructor + * + * @param \phpbb\user $user The user object (used to get language information) + */ + public function __construct(\phpbb\user $user) + { + $this->user = $user; + parent::__construct(); + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('thumbnail:recreate') + ->setDescription($this->user->lang('CLI_DESCRIPTION_THUMBNAIL_RECREATE')) + ; + } + + /** + * Executes the command thumbnail:recreate. + * + * @param InputInterface $input The input stream used to get the argument and verboe option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * + * @return int 0 if all is ok, 1 if a thumbnail couldn't be deleted. + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $parameters = array( + 'command' => 'thumbnail:delete' + ); + + if ($input->getOption('verbose')) + { + $parameters['-v'] = true; + } + + $this->getApplication()->setAutoExit(false); + + $input_delete = new ArrayInput($parameters); + $return = $this->getApplication()->run($input_delete, $output); + + if ($return == 0) + { + $parameters['command'] = 'thumbnail:generate'; + + $input_create = new ArrayInput($parameters); + $return = $this->getApplication()->run($input_create, $output); + } + + $this->getApplication()->setAutoExit(true); + + return $return; + } +} -- cgit v1.2.1 From 074dfdbdfea364cc2796d69c4d27535ab19fdac7 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 13 Jun 2014 15:46:09 +0200 Subject: [ticket/12692] Update doc blocks PHPBB3-12692 --- phpBB/phpbb/console/command/thumbnail/recreate.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'phpBB/phpbb/console/command/thumbnail/recreate.php') diff --git a/phpBB/phpbb/console/command/thumbnail/recreate.php b/phpBB/phpbb/console/command/thumbnail/recreate.php index 569642f2a4..71c5d90654 100644 --- a/phpBB/phpbb/console/command/thumbnail/recreate.php +++ b/phpBB/phpbb/console/command/thumbnail/recreate.php @@ -48,6 +48,8 @@ class recreate extends \phpbb\console\command\command /** * Executes the command thumbnail:recreate. * + * This command is a "macro" to execute thumbnail:delete and then thumbnail:generate. + * * @param InputInterface $input The input stream used to get the argument and verboe option. * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. * -- cgit v1.2.1 From 3924428050d4225c073876bd0e22cf4e9f54138e Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Fri, 13 Jun 2014 21:47:35 +0200 Subject: [ticket/12692] Use strict comparison in thumbnail:recreate PHPBB3-12692 --- phpBB/phpbb/console/command/thumbnail/recreate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command/thumbnail/recreate.php') diff --git a/phpBB/phpbb/console/command/thumbnail/recreate.php b/phpBB/phpbb/console/command/thumbnail/recreate.php index 71c5d90654..69ea67e410 100644 --- a/phpBB/phpbb/console/command/thumbnail/recreate.php +++ b/phpBB/phpbb/console/command/thumbnail/recreate.php @@ -71,7 +71,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 === 0) { $parameters['command'] = 'thumbnail:generate'; -- cgit v1.2.1 From ed0e1590800e00b19115ad1712e75f33d3080a5e Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 17 Jun 2014 22:13:34 +0200 Subject: [ticket/12692] Fix coding style PHPBB3-12692 --- phpBB/phpbb/console/command/thumbnail/recreate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/console/command/thumbnail/recreate.php') diff --git a/phpBB/phpbb/console/command/thumbnail/recreate.php b/phpBB/phpbb/console/command/thumbnail/recreate.php index 69ea67e410..dd10da9106 100644 --- a/phpBB/phpbb/console/command/thumbnail/recreate.php +++ b/phpBB/phpbb/console/command/thumbnail/recreate.php @@ -16,7 +16,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\OutputInterface; -class recreate extends \phpbb\console\command\command +class recreate extends \phpbb\console\command\command { /** @var \phpbb\user */ protected $user; -- cgit v1.2.1 From 487fea8cfffe872e888ebcc3e1f5538b72bcaec1 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Tue, 22 Jul 2014 16:24:40 +0200 Subject: [ticket/12692] Move the language strings to cli.php PHPBB3-12692 --- phpBB/phpbb/console/command/thumbnail/recreate.php | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'phpBB/phpbb/console/command/thumbnail/recreate.php') diff --git a/phpBB/phpbb/console/command/thumbnail/recreate.php b/phpBB/phpbb/console/command/thumbnail/recreate.php index dd10da9106..624e4e507f 100644 --- a/phpBB/phpbb/console/command/thumbnail/recreate.php +++ b/phpBB/phpbb/console/command/thumbnail/recreate.php @@ -18,20 +18,6 @@ use Symfony\Component\Console\Output\OutputInterface; class recreate extends \phpbb\console\command\command { - /** @var \phpbb\user */ - protected $user; - - /** - * Constructor - * - * @param \phpbb\user $user The user object (used to get language information) - */ - public function __construct(\phpbb\user $user) - { - $this->user = $user; - parent::__construct(); - } - /** * Sets the command name and description * -- cgit v1.2.1 From 24e39545ae77a78fb1f5350b4fe5658c924ad75c Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 18 Aug 2014 15:18:08 +0200 Subject: [ticket/12692] Add output PHPBB3-12692 --- phpBB/phpbb/console/command/thumbnail/recreate.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/phpbb/console/command/thumbnail/recreate.php') diff --git a/phpBB/phpbb/console/command/thumbnail/recreate.php b/phpBB/phpbb/console/command/thumbnail/recreate.php index 624e4e507f..ec093161af 100644 --- a/phpBB/phpbb/console/command/thumbnail/recreate.php +++ b/phpBB/phpbb/console/command/thumbnail/recreate.php @@ -54,6 +54,7 @@ class recreate extends \phpbb\console\command\command $this->getApplication()->setAutoExit(false); + $output->writeln('' . $this->user->lang('THUMBNAIL_DELETING') . ''); $input_delete = new ArrayInput($parameters); $return = $this->getApplication()->run($input_delete, $output); @@ -61,6 +62,8 @@ class recreate extends \phpbb\console\command\command { $parameters['command'] = 'thumbnail:generate'; + $output->writeln(''); + $output->writeln('' . $this->user->lang('THUMBNAIL_GENERATING') . ''); $input_create = new ArrayInput($parameters); $return = $this->getApplication()->run($input_create, $output); } -- cgit v1.2.1 From e3e293f5a6b38bb85f57841756a362e26b09088b Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sat, 30 Aug 2014 18:17:23 +0200 Subject: [ticket/12692] Cleanup language file PHPBB3-12692 --- phpBB/phpbb/console/command/thumbnail/recreate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/console/command/thumbnail/recreate.php') diff --git a/phpBB/phpbb/console/command/thumbnail/recreate.php b/phpBB/phpbb/console/command/thumbnail/recreate.php index ec093161af..5d3edbd699 100644 --- a/phpBB/phpbb/console/command/thumbnail/recreate.php +++ b/phpBB/phpbb/console/command/thumbnail/recreate.php @@ -54,7 +54,7 @@ class recreate extends \phpbb\console\command\command $this->getApplication()->setAutoExit(false); - $output->writeln('' . $this->user->lang('THUMBNAIL_DELETING') . ''); + $output->writeln('' . $this->user->lang('CLI_THUMBNAIL_DELETING') . ''); $input_delete = new ArrayInput($parameters); $return = $this->getApplication()->run($input_delete, $output); @@ -63,7 +63,7 @@ class recreate extends \phpbb\console\command\command $parameters['command'] = 'thumbnail:generate'; $output->writeln(''); - $output->writeln('' . $this->user->lang('THUMBNAIL_GENERATING') . ''); + $output->writeln('' . $this->user->lang('CLI_THUMBNAIL_GENERATING') . ''); $input_create = new ArrayInput($parameters); $return = $this->getApplication()->run($input_create, $output); } -- cgit v1.2.1 From 618065ec16030f1d142667473ee2ff42cd80e72b Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Wed, 8 Jul 2015 16:58:45 +0200 Subject: [ticket/12692] Fix tests and update style PHPBB3-12692 --- phpBB/phpbb/console/command/thumbnail/recreate.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'phpBB/phpbb/console/command/thumbnail/recreate.php') diff --git a/phpBB/phpbb/console/command/thumbnail/recreate.php b/phpBB/phpbb/console/command/thumbnail/recreate.php index 5d3edbd699..382da290bf 100644 --- a/phpBB/phpbb/console/command/thumbnail/recreate.php +++ b/phpBB/phpbb/console/command/thumbnail/recreate.php @@ -49,12 +49,11 @@ class recreate extends \phpbb\console\command\command if ($input->getOption('verbose')) { - $parameters['-v'] = true; + $parameters['-' . str_repeat('v', $output->getVerbosity() - 1)] = true; } $this->getApplication()->setAutoExit(false); - $output->writeln('' . $this->user->lang('CLI_THUMBNAIL_DELETING') . ''); $input_delete = new ArrayInput($parameters); $return = $this->getApplication()->run($input_delete, $output); @@ -62,8 +61,6 @@ class recreate extends \phpbb\console\command\command { $parameters['command'] = 'thumbnail:generate'; - $output->writeln(''); - $output->writeln('' . $this->user->lang('CLI_THUMBNAIL_GENERATING') . ''); $input_create = new ArrayInput($parameters); $return = $this->getApplication()->run($input_create, $output); } -- cgit v1.2.1