aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorJoshyPHP <s9e.dev@gmail.com>2015-06-30 00:28:02 +0200
committerJoshyPHP <s9e.dev@gmail.com>2015-06-30 10:32:00 +0200
commit6de5e5cc36d4b934cfa4043faf12adb279f8a2c6 (patch)
tree696cf5ebf3f1d6f0dbd2a5a29cdc09e8333cf5cd /phpBB
parentfadb192c570db25fe4b36b1b3803fb923e6f9d4e (diff)
downloadforums-6de5e5cc36d4b934cfa4043faf12adb279f8a2c6.tar
forums-6de5e5cc36d4b934cfa4043faf12adb279f8a2c6.tar.gz
forums-6de5e5cc36d4b934cfa4043faf12adb279f8a2c6.tar.bz2
forums-6de5e5cc36d4b934cfa4043faf12adb279f8a2c6.tar.xz
forums-6de5e5cc36d4b934cfa4043faf12adb279f8a2c6.zip
[ticket/13891] Added a progress bar
PHPBB3-13891
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/language/en/cli.php2
-rw-r--r--phpBB/phpbb/console/command/reparser/reparse.php26
2 files changed, 21 insertions, 7 deletions
diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php
index c301f98261..d1f229272c 100644
--- a/phpBB/language/en/cli.php
+++ b/phpBB/language/en/cli.php
@@ -85,5 +85,5 @@ $lang = array_merge($lang, array(
'CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS' => 'Successfully recalculated all email hashes.',
- 'CLI_REPARSER_REPARSE_REPARSING' => 'Reparsing %1$s with range %2$d..%3$d',
+ 'CLI_REPARSER_REPARSE_REPARSING' => 'Reparsing %1$s from %2$d to %3$d',
));
diff --git a/phpBB/phpbb/console/command/reparser/reparse.php b/phpBB/phpbb/console/command/reparser/reparse.php
index 5e1993d44c..a2b8b71818 100644
--- a/phpBB/phpbb/console/command/reparser/reparse.php
+++ b/phpBB/phpbb/console/command/reparser/reparse.php
@@ -13,6 +13,7 @@
namespace phpbb\console\command\reparser;
+use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
@@ -116,16 +117,29 @@ class reparse extends \phpbb\console\command\command
$reparser = $this->reparsers[$name];
// Start at range-max if specified or at the highest ID otherwise
- $id = (is_null($input->getOption('range-max'))) ? $reparser->get_max_id() : $input->getOption('range-max');
+ $max = (is_null($input->getOption('range-max'))) ? $reparser->get_max_id() : $input->getOption('range-max');
$min = $input->getOption('range-min');
$size = $input->getOption('range-size');
- while ($id > $min)
+
+ $output->writeLn($this->user->lang('CLI_REPARSER_REPARSE_REPARSING', str_replace('text_reparser.', '', $name), $min, $max) . '</info>');
+
+ $progress = new ProgressBar($output, $max - $min);
+ $progress->start();
+
+ // Start from $max and decrement $current by $size until we reach $min
+ $current = $max;
+ while ($current > $min)
{
- $start = max($min, $id + 1 - $size);
- $end = $id;
- $output->writeln('<info>' . $this->user->lang('CLI_REPARSER_REPARSE_REPARSING', $name, $start, $end) . '</info>');
+ $start = max($min, $current + 1 - $size);
+ $end = $current;
$reparser->reparse_range($start, $end);
- $id -= $size;
+
+ $current = max($min, $start - 1);
+ $progress->setProgress($max - $current);
}
+ $progress->finish();
+
+ // The progress bar does not seem to end with a newline so we add one manually
+ $output->writeLn('');
}
}