Файл: phpbb/console/command/cache/purge.php
Строк: 111
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbbconsolecommandcache;
use SymfonyComponentConsoleInputInputInterface;
use SymfonyComponentConsoleOutputOutputInterface;
class purge extends phpbbconsolecommandcommand
{
/** @var phpbbcachedriverdriver_interface */
protected $cache;
/** @var phpbbdbdriverdriver_interface */
protected $db;
/** @var phpbbauthauth */
protected $auth;
/** @var phpbbloglog_interface */
protected $log;
/** @var phpbbconfigconfig */
protected $config;
/**
* Constructor
*
* @param phpbbuser $user User instance
* @param phpbbcachedriverdriver_interface $cache Cache instance
* @param phpbbdbdriverdriver_interface $db Database connection
* @param phpbbauthauth $auth Auth instance
* @param phpbbloglog $log Logger instance
* @param phpbbconfigconfig $config Config instance
*/
public function __construct(phpbbuser $user, phpbbcachedriverdriver_interface $cache, phpbbdbdriverdriver_interface $db, phpbbauthauth $auth, phpbbloglog_interface $log, phpbbconfigconfig $config)
{
$this->cache = $cache;
$this->db = $db;
$this->auth = $auth;
$this->log = $log;
$this->config = $config;
parent::__construct($user);
}
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('cache:purge')
->setDescription($this->user->lang('PURGE_CACHE'))
;
}
/**
* Executes the command cache:purge.
*
* Purge the cache (including permissions) and increment the asset_version number
*
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*
* @return null
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->config->increment('assets_version', 1);
$this->cache->purge();
// Clear permissions
$this->auth->acl_clear_prefetch();
phpbb_cache_moderators($this->db, $this->cache, $this->auth);
$this->log->add('admin', ANONYMOUS, '', 'LOG_PURGE_CACHE', time(), array());
$output->writeln($this->user->lang('PURGE_CACHE_SUCCESS'));
}
}