diff options
author | Matt Friedman <maf675@gmail.com> | 2016-04-12 10:56:23 -0700 |
---|---|---|
committer | Matt Friedman <maf675@gmail.com> | 2016-04-12 10:56:23 -0700 |
commit | d713ce94ff218c2464823cb23dae1007354c60f3 (patch) | |
tree | 02ab938765ea8725f8aa6426d6bc1f445e4bd5ec /phpBB/phpbb/console/command/thumbnail | |
parent | 336f5b49a7f392ea6e979ef188ffda3caa6271b3 (diff) | |
download | forums-d713ce94ff218c2464823cb23dae1007354c60f3.tar forums-d713ce94ff218c2464823cb23dae1007354c60f3.tar.gz forums-d713ce94ff218c2464823cb23dae1007354c60f3.tar.bz2 forums-d713ce94ff218c2464823cb23dae1007354c60f3.tar.xz forums-d713ce94ff218c2464823cb23dae1007354c60f3.zip |
[ticket/14569] Extract CLI progress bar creation to a method
PHPBB3-14569
Diffstat (limited to 'phpBB/phpbb/console/command/thumbnail')
-rw-r--r-- | phpBB/phpbb/console/command/thumbnail/delete.php | 27 | ||||
-rw-r--r-- | phpBB/phpbb/console/command/thumbnail/generate.php | 27 |
2 files changed, 2 insertions, 52 deletions
diff --git a/phpBB/phpbb/console/command/thumbnail/delete.php b/phpBB/phpbb/console/command/thumbnail/delete.php index e8e4cf568e..cfa9891fbc 100644 --- a/phpBB/phpbb/console/command/thumbnail/delete.php +++ b/phpBB/phpbb/console/command/thumbnail/delete.php @@ -91,32 +91,7 @@ class delete extends \phpbb\console\command\command WHERE thumbnail = 1'; $result = $this->db->sql_query($sql); - $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_DELETING')); diff --git a/phpBB/phpbb/console/command/thumbnail/generate.php b/phpBB/phpbb/console/command/thumbnail/generate.php index e677db3a97..64f7555336 100644 --- a/phpBB/phpbb/console/command/thumbnail/generate.php +++ b/phpBB/phpbb/console/command/thumbnail/generate.php @@ -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')); |