aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/console/command/thumbnail/delete.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/console/command/thumbnail/delete.php')
-rw-r--r--phpBB/phpbb/console/command/thumbnail/delete.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/phpBB/phpbb/console/command/thumbnail/delete.php b/phpBB/phpbb/console/command/thumbnail/delete.php
index b60ea5238f..b57fcc681f 100644
--- a/phpBB/phpbb/console/command/thumbnail/delete.php
+++ b/phpBB/phpbb/console/command/thumbnail/delete.php
@@ -68,11 +68,31 @@ class delete extends \phpbb\console\command\command
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $sql = 'SELECT COUNT(*) AS nb_missing_thumbnails
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE thumbnail = 1';
+ $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('<info>' . $this->user->lang('NO_THUMBNAIL_TO_DELETE') . '</info>');
+ return 0;
+ }
+
$sql = 'SELECT attach_id, physical_filename, extension, real_filename, mimetype
FROM ' . ATTACHMENTS_TABLE . '
WHERE thumbnail = 1';
$result = $this->db->sql_query($sql);
+ if (!$input->getOption('verbose'))
+ {
+ $progress = $this->getHelper('progress');
+ $progress->start($output, $nb_missing_thumbnails);
+ }
+
$thumbnail_deleted = array();
$return = 0;
while ($row = $this->db->sql_fetchrow($result))
@@ -102,6 +122,11 @@ class delete extends \phpbb\console\command\command
$output->writeln('<error>' . $this->user->lang('THUMBNAIL_SKIPPED', $row['real_filename'], $row['physical_filename']) . '</error>');
}
}
+
+ if (!$input->getOption('verbose'))
+ {
+ $progress->advance();
+ }
}
$this->db->sql_freeresult($result);
@@ -110,6 +135,11 @@ class delete extends \phpbb\console\command\command
$this->commit_changes($thumbnail_deleted);
}
+ if (!$input->getOption('verbose'))
+ {
+ $progress->finish();
+ }
+
return $return;
}