mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-25 08:41:53 +02:00
Merge branch '3.2.x'
This commit is contained in:
commit
682c44cee4
@ -13,6 +13,10 @@
|
|||||||
|
|
||||||
namespace phpbb\console\command;
|
namespace phpbb\console\command;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Helper\ProgressBar;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
|
|
||||||
abstract class command extends \Symfony\Component\Console\Command\Command
|
abstract class command extends \Symfony\Component\Console\Command\Command
|
||||||
{
|
{
|
||||||
/** @var \phpbb\user */
|
/** @var \phpbb\user */
|
||||||
@ -28,4 +32,45 @@ abstract class command extends \Symfony\Component\Console\Command\Command
|
|||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a styled progress bar
|
||||||
|
*
|
||||||
|
* @param int $max Max value for the progress bar
|
||||||
|
* @param SymfonyStyle $io Symfony style output decorator
|
||||||
|
* @param OutputInterface $output The output stream, used to print messages
|
||||||
|
* @param bool $message Should we display message output under the progress bar?
|
||||||
|
* @return ProgressBar
|
||||||
|
*/
|
||||||
|
public function create_progress_bar($max, SymfonyStyle $io, OutputInterface $output, $message = false)
|
||||||
|
{
|
||||||
|
$progress = $io->createProgressBar($max);
|
||||||
|
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" .
|
||||||
|
" " . ($message ? '%message%' : ' ') . " %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
|
||||||
|
}
|
||||||
|
|
||||||
|
return $progress;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,44 +121,6 @@ class reparse extends \phpbb\console\command\command
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a styled progress bar
|
|
||||||
*
|
|
||||||
* @param integer $max Max value for the progress bar
|
|
||||||
* @return \Symfony\Component\Console\Helper\ProgressBar
|
|
||||||
*/
|
|
||||||
protected function create_progress_bar($max)
|
|
||||||
{
|
|
||||||
$progress = $this->io->createProgressBar($max);
|
|
||||||
if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE)
|
|
||||||
{
|
|
||||||
$progress->setFormat('<info>[%percent:3s%%]</info> %message%');
|
|
||||||
$progress->setOverwrite(false);
|
|
||||||
}
|
|
||||||
else if ($this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE)
|
|
||||||
{
|
|
||||||
$progress->setFormat('<info>[%current:s%/%max:s%]</info><comment>[%elapsed%/%estimated%][%memory%]</comment> %message%');
|
|
||||||
$progress->setOverwrite(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->io->newLine(2);
|
|
||||||
$progress->setFormat(
|
|
||||||
" %current:s%/%max:s% %bar% %percent:3s%%\n" .
|
|
||||||
" %message% %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
|
|
||||||
}
|
|
||||||
|
|
||||||
return $progress;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the command reparser:reparse
|
* Executes the command reparser:reparse
|
||||||
*
|
*
|
||||||
@ -258,7 +220,7 @@ class reparse extends \phpbb\console\command\command
|
|||||||
|
|
||||||
$this->io->section($this->user->lang('CLI_REPARSER_REPARSE_REPARSING', preg_replace('(^text_reparser\\.)', '', $name), $min, $max));
|
$this->io->section($this->user->lang('CLI_REPARSER_REPARSE_REPARSING', preg_replace('(^text_reparser\\.)', '', $name), $min, $max));
|
||||||
|
|
||||||
$progress = $this->create_progress_bar($max);
|
$progress = $this->create_progress_bar($max, $this->io, $this->output, true);
|
||||||
$progress->setMessage($this->user->lang('CLI_REPARSER_REPARSE_REPARSING_START', preg_replace('(^text_reparser\\.)', '', $name)));
|
$progress->setMessage($this->user->lang('CLI_REPARSER_REPARSE_REPARSING_START', preg_replace('(^text_reparser\\.)', '', $name)));
|
||||||
$progress->start();
|
$progress->start();
|
||||||
|
|
||||||
|
@ -91,32 +91,7 @@ class delete extends \phpbb\console\command\command
|
|||||||
WHERE thumbnail = 1';
|
WHERE thumbnail = 1';
|
||||||
$result = $this->db->sql_query($sql);
|
$result = $this->db->sql_query($sql);
|
||||||
|
|
||||||
$progress = $io->createProgressBar($nb_missing_thumbnails);
|
$progress = $this->create_progress_bar($nb_missing_thumbnails, $io, $output);
|
||||||
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->setMessage($this->user->lang('CLI_THUMBNAIL_DELETING'));
|
$progress->setMessage($this->user->lang('CLI_THUMBNAIL_DELETING'));
|
||||||
|
|
||||||
|
@ -115,32 +115,7 @@ class generate extends \phpbb\console\command\command
|
|||||||
require($this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext);
|
require($this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
$progress = $io->createProgressBar($nb_missing_thumbnails);
|
$progress = $this->create_progress_bar($nb_missing_thumbnails, $io, $output);
|
||||||
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->setMessage($this->user->lang('CLI_THUMBNAIL_GENERATING'));
|
$progress->setMessage($this->user->lang('CLI_THUMBNAIL_GENERATING'));
|
||||||
|
|
||||||
|
@ -141,46 +141,6 @@ class reclean extends command
|
|||||||
return ($i < $limit) ? true : $start + $i;
|
return ($i < $limit) ? true : $start + $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a styled progress bar
|
|
||||||
*
|
|
||||||
* @param integer $max Max value for the progress bar
|
|
||||||
* @param SymfonyStyle $io
|
|
||||||
* @param OutputInterface $output The output stream, used to print messages
|
|
||||||
* @return ProgressBar
|
|
||||||
*/
|
|
||||||
protected function create_progress_bar($max, SymfonyStyle $io, OutputInterface $output)
|
|
||||||
{
|
|
||||||
$progress = $io->createProgressBar($max);
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
return $progress;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the count of users in the database
|
* Get the count of users in the database
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user