diff options
author | Ben Coburn <btcoburn@silicodon.net> | 2006-10-23 07:21:33 +0200 |
---|---|---|
committer | Ben Coburn <btcoburn@silicodon.net> | 2006-10-23 07:21:33 +0200 |
commit | 468441561df674f9df04e53a21d29dd4f1f0c017 (patch) | |
tree | b9acad6b95c993050b74167d13e74886fc29da47 /inc/common.php | |
parent | 173f278305be97fd6d51f90472add11514b5aa29 (diff) | |
download | rpg-468441561df674f9df04e53a21d29dd4f1f0c017.tar.gz rpg-468441561df674f9df04e53a21d29dd4f1f0c017.tar.bz2 |
synchronize changelog, attic, and external edits
The changelog list and the attic now are kept in sync.
This allows a changelog entry to be automatically constructed
for a page that was manually edited from outside dokuwiki.
darcs-hash:20061023052133-05dcb-11b8dbaee1da07fb1875bbe530e88d94871ed65d.gz
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/inc/common.php b/inc/common.php index a477f26a1..5edd417d5 100644 --- a/inc/common.php +++ b/inc/common.php @@ -691,15 +691,32 @@ function saveWikiText($id,$text,$summary,$minor=false){ } $file = wikiFN($id); - $old = saveOldRevision($id); + $old = @filemtime($file); $wasRemoved = empty($text); $wasCreated = !@file_exists($file); $wasReverted = ($REV==true); $newRev = false; + if(!@file_exists(wikiFN($id, $old)) && @file_exists($file)) { + // 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) { + addLogEntry($old, $id); + // send notify mails + notify($id,'admin',$oldRev,'',false); + notify($id,'subscribers',$oldRev,'',false); + // remove soon to be stale instructions + $cache = new cache_instructions($id, $file); + $cache->removeCache(); + } + } if ($wasRemoved){ // pre-save deleted revision @touch($file); + clearstatcache(); $newRev = saveOldRevision($id); // remove empty file @unlink($file); @@ -719,7 +736,8 @@ function saveWikiText($id,$text,$summary,$minor=false){ }else{ // save file (namespace dir is created in io_writeWikiPage) io_writeWikiPage($file, $text, $id); - $newRev = @filemtime($file); + // pre-save the revision, to keep the attic in sync + $newRev = saveOldRevision($id); $del = false; } |