diff options
author | Ben Coburn <btcoburn@silicodon.net> | 2006-10-27 02:00:43 +0200 |
---|---|---|
committer | Ben Coburn <btcoburn@silicodon.net> | 2006-10-27 02:00:43 +0200 |
commit | a701424f8d6706a4fbbd1317907bc0e92b382873 (patch) | |
tree | 82c1287419e64c1f5000bab56a335aa5c2d49306 | |
parent | 468441561df674f9df04e53a21d29dd4f1f0c017 (diff) | |
download | rpg-a701424f8d6706a4fbbd1317907bc0e92b382873.tar.gz rpg-a701424f8d6706a4fbbd1317907bc0e92b382873.tar.bz2 |
synchronize changelog, attic, and external edits - update 1
Removed a minor error that could be caused by a page back-dated
into the past. Also, added some more code comments.
darcs-hash:20061027000043-05dcb-1ccbb4c98b1b7b3358d99d8f097eb168d84259b7.gz
-rw-r--r-- | inc/common.php | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/inc/common.php b/inc/common.php index 5edd417d5..797ff0525 100644 --- a/inc/common.php +++ b/inc/common.php @@ -676,12 +676,19 @@ function con($pre,$text,$suf,$pretty=false){ } /** - * Saves a wikitext by calling io_writeWikiPage + * Saves a wikitext by calling io_writeWikiPage. + * Also directs changelog and attic updates. * * @author Andreas Gohr <andi@splitbrain.org> * @author Ben Coburn <btcoburn@silicodon.net> */ function saveWikiText($id,$text,$summary,$minor=false){ + /* Note to developers: + This code is subtle and delicate. Test the behavior of + the attic and changelog with dokuwiki and external edits + after any changes. External edits change the wiki page + directly without using php or dokuwiki. + */ global $conf; global $lang; global $REV; @@ -691,18 +698,18 @@ function saveWikiText($id,$text,$summary,$minor=false){ } $file = wikiFN($id); - $old = @filemtime($file); + $old = @filemtime($file); // from page $wasRemoved = empty($text); $wasCreated = !@file_exists($file); $wasReverted = ($REV==true); $newRev = false; - if(!@file_exists(wikiFN($id, $old)) && @file_exists($file)) { + $oldRev = getRevisions($id, -1, 1, 1024); // from changelog + $oldRev = (int)(empty($oldRev)?0:$oldRev[0]); + if(!@file_exists(wikiFN($id, $old)) && @file_exists($file) && $old>=$oldRev) { // add old revision to the attic if missing saveOldRevision($id); // add a changelog entry if this edit came from outside dokuwiki - $oldRev = getRevisions($id, -1, 1, 1024); - $oldRev = (int)(empty($oldRev)?0:$oldRev[0]); - if ($oldRev!==$old) { + if ($old>$oldRev) { addLogEntry($old, $id); // send notify mails notify($id,'admin',$oldRev,'',false); |