1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/14569] Extract CLI progress bar creation to a method

PHPBB3-14569
This commit is contained in:
Matt Friedman
2016-04-12 10:56:23 -07:00
parent 336f5b49a7
commit d713ce94ff
5 changed files with 48 additions and 131 deletions

View File

@@ -115,32 +115,7 @@ class generate extends \phpbb\console\command\command
require($this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext);
}
$progress = $io->createProgressBar($nb_missing_thumbnails);
if ($output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE)
{
$progress->setFormat('<info>[%percent:3s%%]</info> %message%');
$progress->setOverwrite(false);
}
else if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE)
{
$progress->setFormat('<info>[%current:s%/%max:s%]</info><comment>[%elapsed%/%estimated%][%memory%]</comment> %message%');
$progress->setOverwrite(false);
}
else
{
$io->newLine(2);
$progress->setFormat(
" %current:s%/%max:s% %bar% %percent:3s%%\n" .
" %elapsed:6s%/%estimated:-6s% %memory:6s%\n");
$progress->setBarWidth(60);
}
if (!defined('PHP_WINDOWS_VERSION_BUILD'))
{
$progress->setEmptyBarCharacter('░'); // light shade character \u2591
$progress->setProgressCharacter('');
$progress->setBarCharacter('▓'); // dark shade character \u2593
}
$progress = $this->create_progress_bar($nb_missing_thumbnails, $io, $output);
$progress->setMessage($this->user->lang('CLI_THUMBNAIL_GENERATING'));