From 8d67c48ac883f874037848be833920f4a6426995 Mon Sep 17 00:00:00 2001
From: Adrian Lang <lang@cosmocode.de>
Date: Wed, 10 Mar 2010 10:07:57 +0100
Subject: [PATCH] Correct edit conflict detection

Edit conflicts occur when a page has been edited since starting the current edit.
In order to detect them, the date of the newest revision is saved.
---
 inc/actions.php | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/inc/actions.php b/inc/actions.php
index 2be5259fd..01d1d29d4 100644
--- a/inc/actions.php
+++ b/inc/actions.php
@@ -312,14 +312,15 @@ function act_save($act){
     global $SUF;
     global $SUM;
     global $lang;
+    global $INFO;
 
     //spam check
     if(checkwordblock()) {
         msg($lang['wordblock'], -1);
         return 'edit';
     }
-    //conflict check //FIXME use INFO
-    if($DATE != 0 && @filemtime(wikiFN($ID)) > $DATE )
+    //conflict check
+    if($DATE != 0 && $INFO['meta']['date']['modified'] > $DATE )
         return 'conflict';
 
     //save it
@@ -487,7 +488,9 @@ function act_edit($act){
         }
     }
 
-    if(!$DATE) $DATE = $INFO['lastmod'];
+    // Use the date of the newest revision, not of the revision we edit
+    // This is used for conflict detection
+    if(!$DATE) $DATE = $INFO['meta']['date']['modified'];
 
     //check if locked by anyone - if not lock for my self
     $lockedby = checklock($ID);
-- 
GitLab