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/generate.php | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'phpBB/phpbb/console/command/thumbnail/generate.php') diff --git a/phpBB/phpbb/console/command/thumbnail/generate.php b/phpBB/phpbb/console/command/thumbnail/generate.php index 640d971b5d..068bd0ff94 100644 --- a/phpBB/phpbb/console/command/thumbnail/generate.php +++ b/phpBB/phpbb/console/command/thumbnail/generate.php @@ -84,6 +84,20 @@ class generate extends \phpbb\console\command\command */ protected function execute(InputInterface $input, OutputInterface $output) { + $sql = 'SELECT COUNT(*) AS nb_missing_thumbnails + FROM ' . ATTACHMENTS_TABLE . ' + WHERE thumbnail = 0'; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $nb_missing_thumbnails = (int) $row['nb_missing_thumbnails']; + if ($nb_missing_thumbnails === 0) + { + $output->writeln('' . $this->user->lang('NO_THUMBNAIL_TO_GENERATE') . ''); + return 0; + } + $extensions = $this->cache->obtain_attach_extensions(true); $sql = 'SELECT attach_id, physical_filename, extension, real_filename, mimetype @@ -96,6 +110,12 @@ class generate extends \phpbb\console\command\command require($this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext); } + if (!$input->getOption('verbose')) + { + $progress = $this->getHelper('progress'); + $progress->start($output, $nb_missing_thumbnails); + } + $thumbnail_created = array(); while ($row = $this->db->sql_fetchrow($result)) { @@ -127,6 +147,11 @@ class generate extends \phpbb\console\command\command } } } + + if (!$input->getOption('verbose')) + { + $progress->advance(); + } } $this->db->sql_freeresult($result); @@ -135,6 +160,11 @@ class generate extends \phpbb\console\command\command $this->commit_changes($thumbnail_created); } + if (!$input->getOption('verbose')) + { + $progress->finish(); + } + return 0; } -- cgit v1.2.1