From cc7d0c94bfa9c4c59fad7c52eb7c9b0decffb885 Mon Sep 17 00:00:00 2001 From: Ben Coburn Date: Wed, 5 Jul 2006 12:56:52 +0200 Subject: IO action events Adds page and namespace events: IO_WIKIPAGE_READ IO_WIKIPAGE_WRITE IO_NAMESPACE_CREATED IO_NAMESPACE_DELETED The namespace events are purely advisory, while the wikipage events allow page content to be modified between DokuWiki and the disk. These events are primarily intended to simplify keeping other tools in sync with the semantic structure of a DokuWiki site. As an added benefit, the events allow plugins to conduct automated processing of raw wiki page content. The namespace events cover the separate namespace trees for both pages and media. The "name" of the tree that the event belongs to is included in the event data. darcs-hash:20060705105652-05dcb-f44024e852a2adf1a14b8a7d69c46db067e72307.gz --- inc/common.php | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index b1246ba7f..564d1f666 100644 --- a/inc/common.php +++ b/inc/common.php @@ -614,7 +614,7 @@ function rawLocale($id){ * @author Andreas Gohr */ function rawWiki($id,$rev=''){ - return io_readFile(wikiFN($id,$rev)); + return io_readWikiPage(wikiFN($id, $rev), $id, $rev); } /** @@ -649,7 +649,7 @@ function pageTemplate($id){ */ function rawWikiSlices($range,$id,$rev=''){ list($from,$to) = split('-',$range,2); - $text = io_readFile(wikiFN($id,$rev)); + $text = io_readWikiPage(wikiFN($id, $rev), $id, $rev); if(!$from) $from = 0; if(!$to) $to = strlen($text)+1; @@ -1019,7 +1019,7 @@ function getRevisionInfo($id,$rev,$mem_cache=true){ /** - * Saves a wikitext by calling io_saveFile + * Saves a wikitext by calling io_writeWikiPage * * @author Andreas Gohr */ @@ -1045,13 +1045,12 @@ function saveWikiText($id,$text,$summary,$minor=false){ $del = true; // autoset summary on deletion if(empty($summary)) $summary = $lang['deleted']; - // unlock early - unlock($id); // remove empty namespaces - io_sweepNS($id); + io_sweepNS($id, 'datadir'); + io_sweepNS($id, 'mediadir'); }else{ - // save file (datadir is created in io_saveFile) - io_saveFile($file,$text); + // save file (namespace dir is created in io_writeWikiPage) + io_writeWikiPage($file, $text, $id); saveMetadata($id, $file, $minor); $del = false; } @@ -1100,12 +1099,7 @@ function saveOldRevision($id){ if(!@file_exists($oldf)) return ''; $date = filemtime($oldf); $newf = wikiFN($id,$date); - if(substr($newf,-3)=='.gz'){ - io_saveFile($newf,rawWiki($id)); - }else{ - io_makeFileDir($newf); - copy($oldf, $newf); - } + io_writeWikiPage($newf, rawWiki($id), $id, $date); return $date; } -- cgit v1.2.3