From 2eccbdaacee808c072a68b7bfd961978025b2bcb Mon Sep 17 00:00:00 2001
From: Gina Haeussge <osd@foosel.net>
Date: Sat, 11 Oct 2008 18:43:42 +0200
Subject: [PATCH] FS#1234: If useheading is enabled, purge the cache of
 backlinks upon save

darcs-hash:20081011164342-2b4f5-b2e26e17ce970927ddbc0c5b888815063d613b0e.gz
---
 inc/common.php | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/inc/common.php b/inc/common.php
index 962c05c37..82a5b7086 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -926,6 +926,16 @@ function saveWikiText($id,$text,$summary,$minor=false){
 
   // update the purgefile (timestamp of the last time anything within the wiki was changed)
   io_saveFile($conf['cachedir'].'/purgefile',time());
+
+  // if useheading is enabled, purge the cache of all linking pages
+  if($conf['useheading']){
+    require_once(DOKU_INC.'inc/fulltext.php');
+    $pages = ft_backlinks($id);
+    foreach ($pages as $page) {
+      $cache = new cache_renderer($page, wikiFN($page), 'xhtml');
+      $cache->removeCache();
+    }
+  }
 }
 
 /**
-- 
GitLab