summaryrefslogtreecommitdiff
path: root/lib/exe
diff options
context:
space:
mode:
authorMichael Klier <chi@chimeric.de>2008-03-05 20:55:32 +0100
committerMichael Klier <chi@chimeric.de>2008-03-05 20:55:32 +0100
commit7305616844af0c5f916578da1a6588f72cba745f (patch)
treef8fa42592fc89598c29fbd3824eac6ae105d540c /lib/exe
parent5cc966ca519dcf56129c03f01e76acebcf3fb166 (diff)
downloadrpg-7305616844af0c5f916578da1a6588f72cba745f.tar.gz
rpg-7305616844af0c5f916578da1a6588f72cba745f.tar.bz2
XMLRPC: new function pageVersions()
This function can be used to retrieve a list of revisions for a given wiki page. darcs-hash:20080305195532-23886-dee2ffff8dcdc21532fb62674edce8a74d6c5525.gz
Diffstat (limited to 'lib/exe')
-rw-r--r--lib/exe/xmlrpc.php57
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php
index 64c85be05..3fe432157 100644
--- a/lib/exe/xmlrpc.php
+++ b/lib/exe/xmlrpc.php
@@ -94,6 +94,12 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
'Returns a struct with infos about the page.'
);
$this->addCallback(
+ 'wiki.getPageVersions',
+ 'this:pageVersions',
+ array('struct','string','int'),
+ 'Returns the available revisions of the page.'
+ );
+ $this->addCallback(
'wiki.putPage',
'this:putPage',
array('int', 'string', 'string', 'struct'),
@@ -346,6 +352,57 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
}
/**
+ * Returns a list of available revisions of a given wiki page
+ *
+ * @author Michael Klier <chi@chimeric.de>
+ */
+ function pageVersions($id, $first) {
+ global $conf;
+
+ $versions = array();
+
+ if(empty($id))
+ return new IXR_Error(1, 'Empty page ID');
+
+ require_once(DOKU_INC.'inc/changelog.php');
+
+ $revisions = getRevisions($id, $first, $conf['recent']+1);
+
+ if(count($revisions)==0 && $first!=0) {
+ $first=0;
+ $revisions = getRevisions($id, $first, $conf['recent']+1);
+ }
+
+ $hasNext = false;
+ if (count($revisions)>$conf['recent']) {
+ $hasNext = true;
+ array_pop($revisions); // remove extra log entry
+ }
+
+ if(!empty($revisions)) {
+ foreach($revisions as $rev) {
+ $file = wikiFN($id,$rev);
+ $time = @filemtime($file);
+ if($time){
+ $info = getRevisionInfo($id, $time, 1024);
+ if(!empty($info)) {
+ $data['user'] = $info['user'];
+ $data['ip'] = $info['ip'];
+ $data['type'] = $info['type'];
+ $data['sum'] = $info['sum'];
+ $data['modified'] = new IXR_Date($info['date']);
+ $data['version'] = $info['date'];
+ array_push($versions, $data);
+ }
+ }
+ }
+ return $versions;
+ } else {
+ return array();
+ }
+ }
+
+ /**
* The version of Wiki RPC API supported
*/
function wiki_RPCVersion(){