diff options
author | Andreas Fischer <bantu@phpbb.com> | 2014-05-06 18:33:40 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2014-05-06 18:33:40 +0200 |
commit | 0d4a7d76f4a0bbc87c29a0b3a504ae1f4c38c457 (patch) | |
tree | 1b642919d45fa05b4adc59b29b5b78f5a3375afc /phpBB/phpbb/console/command/cache | |
parent | 571d6ae852fd6bc6d3ce57b00cb1faed84f45434 (diff) | |
parent | 09011288b6678196d745a5611b27fa0d64c127d5 (diff) | |
download | forums-0d4a7d76f4a0bbc87c29a0b3a504ae1f4c38c457.tar forums-0d4a7d76f4a0bbc87c29a0b3a504ae1f4c38c457.tar.gz forums-0d4a7d76f4a0bbc87c29a0b3a504ae1f4c38c457.tar.bz2 forums-0d4a7d76f4a0bbc87c29a0b3a504ae1f4c38c457.tar.xz forums-0d4a7d76f4a0bbc87c29a0b3a504ae1f4c38c457.zip |
Merge pull request #2416 from Nicofuma/ticket/12507
[ticket/12507] Add console command to purge the cache
* Nicofuma/ticket/12507:
[ticket/12507] Move the 'require' statement
[ticket/12507] Add console command to purge the cache
Diffstat (limited to 'phpBB/phpbb/console/command/cache')
-rw-r--r-- | phpBB/phpbb/console/command/cache/purge.php | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php new file mode 100644 index 0000000000..017bdc5144 --- /dev/null +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -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')); + } +} |