From 6cc34b5041e235805e37756b146b86a62f104e2a Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Thu, 11 Dec 2008 23:03:58 +0100 Subject: [PATCH] Fix cache management of the wiki. Signed-off-by: Florent Bruneau --- classes/plwikipage.php | 12 ++++++++++++ include/wiki.engine.inc.php | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/classes/plwikipage.php b/classes/plwikipage.php index 6f28191..787b293 100644 --- a/classes/plwikipage.php +++ b/classes/plwikipage.php @@ -64,6 +64,18 @@ class PlWikiPage return self::workDir() . '/cache_' . $this->name . '.tpl'; } + /** Remove the cache for the current page. + */ + public function removePageCache() + { + @unlink($this->cacheFilename()); + global $globals; + $page = glob($globals->spoolroot . '/spool/templates_c/*cache_' . $this->name . '.tpl.php'); + if (count($page) > 0) { + @unlink($page[0]); + } + } + /** Fetch the content of the wiki page. */ private function fetchContent() diff --git a/include/wiki.engine.inc.php b/include/wiki.engine.inc.php index fe72475..ae32040 100644 --- a/include/wiki.engine.inc.php +++ b/include/wiki.engine.inc.php @@ -59,7 +59,8 @@ $wiki_cache = $wp->cacheFilename(); $cache_exists = file_exists($wiki_cache); if (Env::v('action') || !$cache_exists) { if ($cache_exists && !$feed) { - unlink($wiki_cache); + $wp->removePageCache(); + $cache_exists = false; } // we leave pmwiki do whatever it wants and store everything -- 2.1.4