Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changes getRevisionHtml() to getRevision() so it returns more revisio…

…n properties.
  • Loading branch information...
commit 181f5e574123045025310944bcced0cb98227175 1 parent 0ab080d
Jim Safley authored
Showing with 26 additions and 5 deletions.
  1. +26 −5 lib/Scripto.php
View
31 lib/Scripto.php
@@ -355,13 +355,34 @@ public function getRevisionDiff($fromRevisionId, $toRevisionId = 'prev')
}
/**
- * Get the HTML of a specified revision of a given page.
+ * Get properties of the specified page revision.
*
* @param int $revisionId
- * @return string
+ * @return array
*/
- public function getRevisionHtml($revisionId)
+ public function getRevision($revisionId)
{
- return $this->_mediawiki->getRevisionHtml($revisionId);
- }
+ // Get the revision properties.
+ $response = $this->_mediawiki->getRevisions(
+ null,
+ array('revids' => $revisionId,
+ 'rvprop' => 'ids|flags|timestamp|user|comment|size|content')
+ );
+ $page = current($response['query']['pages']);
+
+ // Parse the wikitext into HTML.
+ $response = $this->_mediawiki->parse(
+ array('text' => '__NOEDITSECTION__' . $page['revisions'][0]['*'])
+ );
+
+ $revision = array('revision_id' => $page['revisions'][0]['revid'],
+ 'parent_id' => $page['revisions'][0]['parentid'],
+ 'user' => $page['revisions'][0]['user'],
+ 'timestamp' => $page['revisions'][0]['timestamp'],
+ 'comment' => $page['revisions'][0]['comment'],
+ 'size' => $page['revisions'][0]['size'],
+ 'wikitext' => $page['revisions'][0]['*'],
+ 'html' => $response['parse']['text']['*']);
+ return $revision;
+ }
}

0 comments on commit 181f5e5

Please sign in to comment.
Something went wrong with that request. Please try again.