1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

[ticket/16432] Display APCu Cache notice when handling extensions through CLI

PHPBB3-16432
This commit is contained in:
mrgoldy
2020-04-12 00:46:00 +02:00
parent c990818200
commit 3e128d06f4
7 changed files with 46 additions and 6 deletions

View File

@@ -12,6 +12,8 @@
*/
namespace phpbb\console\command\extension;
use Symfony\Component\Console\Style\SymfonyStyle;
abstract class command extends \phpbb\console\command\command
{
/** @var \phpbb\extension\manager */
@@ -20,11 +22,37 @@ abstract class command extends \phpbb\console\command\command
/** @var \phpbb\log\log */
protected $log;
public function __construct(\phpbb\user $user, \phpbb\extension\manager $manager, \phpbb\log\log $log)
/** @var string Cache driver class */
protected $cache_driver_class;
/**
* Constructor.
*
* @param \phpbb\user $user User object
* @param \phpbb\extension\manager $manager Extension manager object
* @param \phpbb\log\log $log Log object
* @param string $cache_driver_class Cache driver class
*/
public function __construct(\phpbb\user $user, \phpbb\extension\manager $manager, \phpbb\log\log $log, $cache_driver_class)
{
$this->manager = $manager;
$this->log = $log;
$this->cache_driver_class = $cache_driver_class;
parent::__construct($user);
}
/**
* Check if APCu cache driver is used and enabled for CLI, otherwise display a notice.
*
* @param SymfonyStyle $io
* @return void
*/
protected function check_apcu_cache(SymfonyStyle $io)
{
if ($this->cache_driver_class === 'phpbb\\cache\\driver\\apcu' && !@ini_get('apc.enable_cli'))
{
$io->note($this->user->lang('CLI_APCU_CACHE_NOTICE'));
}
}
}