mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-22 03:08:54 +00:00
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus: [ticket/12507] Move the 'require' statement [ticket/12507] Add console command to purge the cache
This commit is contained in:
commit
801cac50bd
3 changed files with 74 additions and 0 deletions
|
@ -21,6 +21,7 @@ require($phpbb_root_path . 'includes/startup.' . $phpEx);
|
||||||
require($phpbb_root_path . 'config.' . $phpEx);
|
require($phpbb_root_path . 'config.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/constants.' . $phpEx);
|
require($phpbb_root_path . 'includes/constants.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/functions.' . $phpEx);
|
require($phpbb_root_path . 'includes/functions.' . $phpEx);
|
||||||
|
require($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/functions_container.' . $phpEx);
|
require($phpbb_root_path . 'includes/functions_container.' . $phpEx);
|
||||||
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
||||||
require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
|
require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
|
||||||
|
|
|
@ -1,4 +1,15 @@
|
||||||
services:
|
services:
|
||||||
|
console.command.cache.purge:
|
||||||
|
class: phpbb\console\command\cache\purge
|
||||||
|
arguments:
|
||||||
|
- @cache.driver
|
||||||
|
- @dbal.conn
|
||||||
|
- @auth
|
||||||
|
- @log
|
||||||
|
- @user
|
||||||
|
tags:
|
||||||
|
- { name: console.command }
|
||||||
|
|
||||||
console.command.config.delete:
|
console.command.config.delete:
|
||||||
class: phpbb\console\command\config\delete
|
class: phpbb\console\command\config\delete
|
||||||
arguments:
|
arguments:
|
||||||
|
|
62
phpBB/phpbb/console/command/cache/purge.php
vendored
Normal file
62
phpBB/phpbb/console/command/cache/purge.php
vendored
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package phpBB3
|
||||||
|
* @copyright (c) 2014 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
namespace phpbb\console\command\cache;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
class purge extends \phpbb\console\command\command
|
||||||
|
{
|
||||||
|
/** @var \phpbb\cache\driver\driver_interface */
|
||||||
|
protected $cache;
|
||||||
|
|
||||||
|
/** @var \phpbb\db\driver\driver_interface */
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
/** @var \phpbb\auth\auth */
|
||||||
|
protected $auth;
|
||||||
|
|
||||||
|
/** @var \phpbb\log\log */
|
||||||
|
protected $log;
|
||||||
|
|
||||||
|
/** @var \phpbb\user */
|
||||||
|
protected $user;
|
||||||
|
|
||||||
|
function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\user $user)
|
||||||
|
{
|
||||||
|
$this->cache = $cache;
|
||||||
|
$this->db = $db;
|
||||||
|
$this->auth = $auth;
|
||||||
|
$this->log = $log;
|
||||||
|
$this->user = $user;
|
||||||
|
$this->user->add_lang(array('acp/common'));
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configure()
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->setName('cache:purge')
|
||||||
|
->setDescription('Purge the cache.')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
|
{
|
||||||
|
$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'));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue