1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-11 10:05:19 +02:00

[ticket/11768] Invalidate the text_formatter cache whenever a style is installed

The acp_styles module purges the cache every time a style is uninstalled,
modified or made default, but it does not purge the cache when a new style
is installed. Here we invalidate the text_formatter cache (not purge the
whole cache) so that new styles take effect immediately.

PHPBB3-11768
This commit is contained in:
JoshyPHP 2015-03-05 00:06:52 +01:00
parent 1a133d5487
commit ec77ff7838

View File

@ -53,6 +53,9 @@ class acp_styles
/** @var \phpbb\auth\auth */
protected $auth;
/** @var \phpbb\textformatter\cache */
protected $text_formatter_cache;
/** @var string */
protected $phpbb_root_path;
@ -61,7 +64,7 @@ class acp_styles
public function main($id, $mode)
{
global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config;
global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config, $phpbb_container;
$this->db = $db;
$this->user = $user;
@ -69,6 +72,7 @@ class acp_styles
$this->request = $request;
$this->cache = $cache;
$this->auth = $auth;
$this->text_formatter_cache = $phpbb_container->get('text_formatter.cache');
$this->config = $config;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
@ -216,6 +220,12 @@ class acp_styles
}
}
// Invalidate the text formatter's cache for the new styles to take effect
if (!empty($installed_names))
{
$this->text_formatter_cache->invalidate();
}
// Show message
if (!count($messages))
{