aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshyPHP <s9e.dev@gmail.com>2015-03-05 00:06:52 +0100
committerJoshyPHP <s9e.dev@gmail.com>2015-04-02 19:16:03 +0200
commitec77ff7838e317deb5facacfae31402af08a9902 (patch)
treec58317c30164566d0f4e5298ec3e0e8591ff647f
parent1a133d548712f16801ed2a8617aa7eed7f30688c (diff)
downloadforums-ec77ff7838e317deb5facacfae31402af08a9902.tar
forums-ec77ff7838e317deb5facacfae31402af08a9902.tar.gz
forums-ec77ff7838e317deb5facacfae31402af08a9902.tar.bz2
forums-ec77ff7838e317deb5facacfae31402af08a9902.tar.xz
forums-ec77ff7838e317deb5facacfae31402af08a9902.zip
[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
-rw-r--r--phpBB/includes/acp/acp_styles.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index 45f224f8b1..904769f0d1 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -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))
{