summaryrefslogtreecommitdiff
path: root/inc/common.php
diff options
context:
space:
mode:
authorBen Coburn <btcoburn@silicodon.net>2006-07-05 12:56:52 +0200
committerBen Coburn <btcoburn@silicodon.net>2006-07-05 12:56:52 +0200
commitcc7d0c94bfa9c4c59fad7c52eb7c9b0decffb885 (patch)
tree2fbf29ad89b91e4a138b2afb730a5a105e0a1b87 /inc/common.php
parentc9b4bd1e30a047b11d0beaa4458204126e0c1b92 (diff)
downloadrpg-cc7d0c94bfa9c4c59fad7c52eb7c9b0decffb885.tar.gz
rpg-cc7d0c94bfa9c4c59fad7c52eb7c9b0decffb885.tar.bz2
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
Diffstat (limited to 'inc/common.php')
-rw-r--r--inc/common.php22
1 files changed, 8 insertions, 14 deletions
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 <andi@splitbrain.org>
*/
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 <andi@splitbrain.org>
*/
@@ -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;
}