From c5f927421e944bfe2ed61a7d50177e7a04c7a079 Mon Sep 17 00:00:00 2001
From: Michael Hamann <michael@content-space.de>
Date: Fri, 19 Aug 2011 16:10:08 +0200
Subject: [PATCH] Don't delete meta files when pages are deleted, fixes FS#2301

As we need to keep all core meta files anyway (the only core file that
had been deleted but shouldn't be deleted is the .indexed file) and
plugins can keep care of their own metadata files using the
IO_WIKIPAGE_WRITE event there is no reason for using the expensive
metaFiles() function during the deletion of pages.
---
 inc/common.php | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/inc/common.php b/inc/common.php
index 7522095ab..239cfcf99 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -1007,16 +1007,8 @@ function saveWikiText($id,$text,$summary,$minor=false){
         $newRev = saveOldRevision($id);
         // remove empty file
         @unlink($file);
-        // remove old meta info...
-        $mfiles = metaFiles($id);
-        $changelog = metaFN($id, '.changes');
-        $metadata  = metaFN($id, '.meta');
-        $subscribers = metaFN($id, '.mlist');
-        foreach ($mfiles as $mfile) {
-            // but keep per-page changelog to preserve page history, keep subscriber list and keep meta data
-            if (@file_exists($mfile) && $mfile!==$changelog && $mfile!==$metadata && $mfile!==$subscribers) { @unlink($mfile); }
-        }
-        // purge meta data
+        // don't remove old meta info as it should be saved, plugins can use IO_WIKIPAGE_WRITE for removing their metadata...
+        // purge non-persistant meta data
         p_purge_metadata($id);
         $del = true;
         // autoset summary on deletion
-- 
GitLab