From: Florent Bruneau Date: Thu, 11 Dec 2008 22:03:58 +0000 (+0100) Subject: Fix cache management of the wiki. X-Git-Tag: core/1.0.1~11^2~9 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=6cc34b5041e235805e37756b146b86a62f104e2a;hp=ada4c57e583132ebdd44c3e67a50118bf8c68b92;p=platal.git Fix cache management of the wiki. Signed-off-by: Florent Bruneau --- 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