3 * API for MediaWiki 1.8+
5 * Created on Sep 7, 2006
7 * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * http://www.gnu.org/copyleft/gpl.html
27 if ( !defined( 'MEDIAWIKI' ) ) {
28 // Eclipse helper - will be ignored in production
29 require_once( 'ApiQueryBase.php' );
33 * A query action to enumerate revisions of a given page, or show top revisions of multiple pages.
34 * Various pieces of information may be shown - flags, comments, and the actual wiki markup of the rev.
35 * In the enumeration mode, ranges of revisions may be requested and filtered.
39 class ApiQueryRevisions
extends ApiQueryBase
{
41 private $diffto, $difftotext, $expandTemplates, $generateXML, $section,
44 public function __construct( $query, $moduleName ) {
45 parent
::__construct( $query, $moduleName, 'rv' );
48 private $fld_ids = false, $fld_flags = false, $fld_timestamp = false, $fld_size = false,
49 $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_userid = false,
50 $fld_content = false, $fld_tags = false;
52 private $tokenFunctions;
54 protected function getTokenFunctions() {
55 // tokenname => function
56 // function prototype is func($pageid, $title, $rev)
57 // should return token or false
59 // Don't call the hooks twice
60 if ( isset( $this->tokenFunctions
) ) {
61 return $this->tokenFunctions
;
64 // If we're in JSON callback mode, no tokens can be obtained
65 if ( !is_null( $this->getMain()->getRequest()->getVal( 'callback' ) ) ) {
69 $this->tokenFunctions
= array(
70 'rollback' => array( 'ApiQueryRevisions', 'getRollbackToken' )
72 wfRunHooks( 'APIQueryRevisionsTokens', array( &$this->tokenFunctions
) );
73 return $this->tokenFunctions
;
76 public static function getRollbackToken( $pageid, $title, $rev ) {
78 if ( !$wgUser->isAllowed( 'rollback' ) ) {
81 return $wgUser->editToken( array( $title->getPrefixedText(),
82 $rev->getUserText() ) );
85 public function execute() {
86 $params = $this->extractRequestParams( false );
88 // If any of those parameters are used, work in 'enumeration' mode.
89 // Enum mode can only be used when exactly one page is provided.
90 // Enumerating revisions on multiple pages make it extremely
91 // difficult to manage continuations and require additional SQL indexes
92 $enumRevMode = ( !is_null( $params['user'] ) ||
!is_null( $params['excludeuser'] ) ||
93 !is_null( $params['limit'] ) ||
!is_null( $params['startid'] ) ||
94 !is_null( $params['endid'] ) ||
$params['dir'] === 'newer' ||
95 !is_null( $params['start'] ) ||
!is_null( $params['end'] ) );
98 $pageSet = $this->getPageSet();
99 $pageCount = $pageSet->getGoodTitleCount();
100 $revCount = $pageSet->getRevisionCount();
102 // Optimization -- nothing to do
103 if ( $revCount === 0 && $pageCount === 0 ) {
107 if ( $revCount > 0 && $enumRevMode ) {
108 $this->dieUsage( 'The revids= parameter may not be used with the list options (limit, startid, endid, dirNewer, start, end).', 'revids' );
111 if ( $pageCount > 1 && $enumRevMode ) {
112 $this->dieUsage( 'titles, pageids or a generator was used to supply multiple pages, but the limit, startid, endid, dirNewer, user, excludeuser, start and end parameters may only be used on a single page.', 'multpages' );
115 if ( !is_null( $params['difftotext'] ) ) {
116 $this->difftotext
= $params['difftotext'];
117 } elseif ( !is_null( $params['diffto'] ) ) {
118 if ( $params['diffto'] == 'cur' ) {
119 $params['diffto'] = 0;
121 if ( ( !ctype_digit( $params['diffto'] ) ||
$params['diffto'] < 0 )
122 && $params['diffto'] != 'prev' && $params['diffto'] != 'next' )
124 $this->dieUsage( 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"', 'diffto' );
126 // Check whether the revision exists and is readable,
127 // DifferenceEngine returns a rather ambiguous empty
128 // string if that's not the case
129 if ( $params['diffto'] != 0 ) {
130 $difftoRev = Revision
::newFromID( $params['diffto'] );
132 $this->dieUsageMsg( array( 'nosuchrevid', $params['diffto'] ) );
134 if ( !$difftoRev->userCan( Revision
::DELETED_TEXT
) ) {
135 $this->setWarning( "Couldn't diff to r{$difftoRev->getID()}: content is hidden" );
136 $params['diffto'] = null;
139 $this->diffto
= $params['diffto'];
142 $db = $this->getDB();
143 $this->addTables( 'page' );
144 $this->addFields( Revision
::selectFields() );
145 $this->addWhere( 'page_id = rev_page' );
147 $prop = array_flip( $params['prop'] );
150 $this->fld_ids
= isset ( $prop['ids'] );
151 // $this->addFieldsIf('rev_text_id', $this->fld_ids); // should this be exposed?
152 $this->fld_flags
= isset ( $prop['flags'] );
153 $this->fld_timestamp
= isset ( $prop['timestamp'] );
154 $this->fld_comment
= isset ( $prop['comment'] );
155 $this->fld_parsedcomment
= isset ( $prop['parsedcomment'] );
156 $this->fld_size
= isset ( $prop['size'] );
157 $this->fld_userid
= isset( $prop['userid'] );
158 $this->fld_user
= isset ( $prop['user'] );
159 $this->token
= $params['token'];
161 // Possible indexes used
164 $userMax = ( $this->fld_content ? ApiBase
::LIMIT_SML1
: ApiBase
::LIMIT_BIG1
);
165 $botMax = ( $this->fld_content ? ApiBase
::LIMIT_SML2
: ApiBase
::LIMIT_BIG2
);
166 $limit = $params['limit'];
167 if ( $limit == 'max' ) {
168 $limit = $this->getMain()->canApiHighLimits() ?
$botMax : $userMax;
169 $this->getResult()->setParsedLimit( $this->getModuleName(), $limit );
173 if ( !is_null( $this->token
) ||
$pageCount > 0 ) {
174 $this->addFields( Revision
::selectPageFields() );
177 if ( isset( $prop['tags'] ) ) {
178 $this->fld_tags
= true;
179 $this->addTables( 'tag_summary' );
180 $this->addJoinConds( array( 'tag_summary' => array( 'LEFT JOIN', array( 'rev_id=ts_rev_id' ) ) ) );
181 $this->addFields( 'ts_tags' );
184 if ( !is_null( $params['tag'] ) ) {
185 $this->addTables( 'change_tag' );
186 $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) );
187 $this->addWhereFld( 'ct_tag' , $params['tag'] );
188 global $wgOldChangeTagsIndex;
189 $index['change_tag'] = $wgOldChangeTagsIndex ?
'ct_tag' : 'change_tag_tag_id';
192 if ( isset( $prop['content'] ) ||
!is_null( $this->difftotext
) ) {
193 // For each page we will request, the user must have read rights for that page
194 foreach ( $pageSet->getGoodTitles() as $title ) {
195 if ( !$title->userCanRead() ) {
197 'The current user is not allowed to read ' . $title->getPrefixedText(),
202 $this->addTables( 'text' );
203 $this->addWhere( 'rev_text_id=old_id' );
204 $this->addFields( 'old_id' );
205 $this->addFields( Revision
::selectTextFields() );
207 $this->fld_content
= isset( $prop['content'] );
209 $this->expandTemplates
= $params['expandtemplates'];
210 $this->generateXML
= $params['generatexml'];
211 $this->parseContent
= $params['parse'];
212 if ( $this->parseContent
) {
213 // We are only going to parse 1 revision per request
214 $this->validateLimit( 'limit', $limit, 1, 1, 1 );
216 if ( isset( $params['section'] ) ) {
217 $this->section
= $params['section'];
219 $this->section
= false;
223 //Bug 24166 - API error when using rvprop=tags
224 $this->addTables( 'revision' );
227 if ( $enumRevMode ) {
228 // This is mostly to prevent parameter errors (and optimize SQL?)
229 if ( !is_null( $params['startid'] ) && !is_null( $params['start'] ) ) {
230 $this->dieUsage( 'start and startid cannot be used together', 'badparams' );
233 if ( !is_null( $params['endid'] ) && !is_null( $params['end'] ) ) {
234 $this->dieUsage( 'end and endid cannot be used together', 'badparams' );
237 if ( !is_null( $params['user'] ) && !is_null( $params['excludeuser'] ) ) {
238 $this->dieUsage( 'user and excludeuser cannot be used together', 'badparams' );
241 // This code makes an assumption that sorting by rev_id and rev_timestamp produces
242 // the same result. This way users may request revisions starting at a given time,
243 // but to page through results use the rev_id returned after each page.
244 // Switching to rev_id removes the potential problem of having more than
245 // one row with the same timestamp for the same page.
246 // The order needs to be the same as start parameter to avoid SQL filesort.
247 if ( is_null( $params['startid'] ) && is_null( $params['endid'] ) ) {
248 $this->addWhereRange( 'rev_timestamp', $params['dir'],
249 $params['start'], $params['end'] );
251 $this->addWhereRange( 'rev_id', $params['dir'],
252 $params['startid'], $params['endid'] );
253 // One of start and end can be set
254 // If neither is set, this does nothing
255 $this->addWhereRange( 'rev_timestamp', $params['dir'],
256 $params['start'], $params['end'], false );
259 // must manually initialize unset limit
260 if ( is_null( $limit ) ) {
263 $this->validateLimit( 'limit', $limit, 1, $userMax, $botMax );
265 // There is only one ID, use it
266 $ids = array_keys( $pageSet->getGoodTitles() );
267 $this->addWhereFld( 'rev_page', reset( $ids ) );
269 if ( !is_null( $params['user'] ) ) {
270 $this->addWhereFld( 'rev_user_text', $params['user'] );
271 } elseif ( !is_null( $params['excludeuser'] ) ) {
272 $this->addWhere( 'rev_user_text != ' .
273 $db->addQuotes( $params['excludeuser'] ) );
275 if ( !is_null( $params['user'] ) ||
!is_null( $params['excludeuser'] ) ) {
276 // Paranoia: avoid brute force searches (bug 17342)
277 $this->addWhere( $db->bitAnd( 'rev_deleted', Revision
::DELETED_USER
) . ' = 0' );
279 } elseif ( $revCount > 0 ) {
280 $max = $this->getMain()->canApiHighLimits() ?
$botMax : $userMax;
281 $revs = $pageSet->getRevisionIDs();
282 if ( self
::truncateArray( $revs, $max ) ) {
283 $this->setWarning( "Too many values supplied for parameter 'revids': the limit is $max" );
286 // Get all revision IDs
287 $this->addWhereFld( 'rev_id', array_keys( $revs ) );
289 if ( !is_null( $params['continue'] ) ) {
290 $this->addWhere( "rev_id >= '" . intval( $params['continue'] ) . "'" );
292 $this->addOption( 'ORDER BY', 'rev_id' );
294 // assumption testing -- we should never get more then $revCount rows.
296 } elseif ( $pageCount > 0 ) {
297 $max = $this->getMain()->canApiHighLimits() ?
$botMax : $userMax;
298 $titles = $pageSet->getGoodTitles();
299 if ( self
::truncateArray( $titles, $max ) ) {
300 $this->setWarning( "Too many values supplied for parameter 'titles': the limit is $max" );
303 // When working in multi-page non-enumeration mode,
304 // limit to the latest revision only
305 $this->addWhere( 'page_id=rev_page' );
306 $this->addWhere( 'page_latest=rev_id' );
309 $this->addWhereFld( 'page_id', array_keys( $titles ) );
310 // Every time someone relies on equality propagation, god kills a kitten :)
311 $this->addWhereFld( 'rev_page', array_keys( $titles ) );
313 if ( !is_null( $params['continue'] ) ) {
314 $cont = explode( '|', $params['continue'] );
315 if ( count( $cont ) != 2 ) {
316 $this->dieUsage( 'Invalid continue param. You should pass the original ' .
317 'value returned by the previous query', '_badcontinue' );
319 $pageid = intval( $cont[0] );
320 $revid = intval( $cont[1] );
322 "rev_page > '$pageid' OR " .
323 "(rev_page = '$pageid' AND " .
324 "rev_id >= '$revid')"
327 $this->addOption( 'ORDER BY', 'rev_page, rev_id' );
329 // assumption testing -- we should never get more then $pageCount rows.
332 ApiBase
::dieDebug( __METHOD__
, 'param validation?' );
335 $this->addOption( 'LIMIT', $limit +
1 );
336 $this->addOption( 'USE INDEX', $index );
339 $res = $this->select( __METHOD__
);
341 foreach ( $res as $row ) {
342 if ( ++
$count > $limit ) {
343 // We've reached the one extra which shows that there are additional pages to be had. Stop here...
344 if ( !$enumRevMode ) {
345 ApiBase
::dieDebug( __METHOD__
, 'Got more rows then expected' ); // bug report
347 $this->setContinueEnumParameter( 'startid', intval( $row->rev_id
) );
351 $fit = $this->addPageSubItem( $row->rev_page
, $this->extractRowInfo( $row ), 'rev' );
353 if ( $enumRevMode ) {
354 $this->setContinueEnumParameter( 'startid', intval( $row->rev_id
) );
355 } elseif ( $revCount > 0 ) {
356 $this->setContinueEnumParameter( 'continue', intval( $row->rev_id
) );
358 $this->setContinueEnumParameter( 'continue', intval( $row->rev_page
) .
359 '|' . intval( $row->rev_id
) );
366 private function extractRowInfo( $row ) {
367 $revision = new Revision( $row );
368 $title = $revision->getTitle();
371 if ( $this->fld_ids
) {
372 $vals['revid'] = intval( $revision->getId() );
373 // $vals['oldid'] = intval( $row->rev_text_id ); // todo: should this be exposed?
374 if ( !is_null( $revision->getParentId() ) ) {
375 $vals['parentid'] = intval( $revision->getParentId() );
379 if ( $this->fld_flags
&& $revision->isMinor() ) {
383 if ( $this->fld_user ||
$this->fld_userid
) {
384 if ( $revision->isDeleted( Revision
::DELETED_USER
) ) {
385 $vals['userhidden'] = '';
387 if ( $this->fld_user
) {
388 $vals['user'] = $revision->getUserText();
390 $userid = $revision->getUser();
395 if ( $this->fld_userid
) {
396 $vals['userid'] = $userid;
401 if ( $this->fld_timestamp
) {
402 $vals['timestamp'] = wfTimestamp( TS_ISO_8601
, $revision->getTimestamp() );
405 if ( $this->fld_size
&& !is_null( $revision->getSize() ) ) {
406 $vals['size'] = intval( $revision->getSize() );
409 if ( $this->fld_comment ||
$this->fld_parsedcomment
) {
410 if ( $revision->isDeleted( Revision
::DELETED_COMMENT
) ) {
411 $vals['commenthidden'] = '';
413 $comment = $revision->getComment();
415 if ( $this->fld_comment
) {
416 $vals['comment'] = $comment;
419 if ( $this->fld_parsedcomment
) {
421 $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $comment, $title );
426 if ( $this->fld_tags
) {
427 if ( $row->ts_tags
) {
428 $tags = explode( ',', $row->ts_tags
);
429 $this->getResult()->setIndexedTagName( $tags, 'tag' );
430 $vals['tags'] = $tags;
432 $vals['tags'] = array();
436 if ( !is_null( $this->token
) ) {
437 $tokenFunctions = $this->getTokenFunctions();
438 foreach ( $this->token
as $t ) {
439 $val = call_user_func( $tokenFunctions[$t], $title->getArticleID(), $title, $revision );
440 if ( $val === false ) {
441 $this->setWarning( "Action '$t' is not allowed for the current user" );
443 $vals[$t . 'token'] = $val;
450 if ( $this->fld_content ||
!is_null( $this->difftotext
) ) {
451 $text = $revision->getText();
452 // Expand templates after getting section content because
453 // template-added sections don't count and Parser::preprocess()
454 // will have less input
455 if ( $this->section
!== false ) {
456 $text = $wgParser->getSection( $text, $this->section
, false );
457 if ( $text === false ) {
458 $this->dieUsage( "There is no section {$this->section} in r" . $revision->getId(), 'nosuchsection' );
462 if ( $this->fld_content
&& !$revision->isDeleted( Revision
::DELETED_TEXT
) ) {
463 if ( $this->generateXML
) {
464 $wgParser->startExternalParse( $title, new ParserOptions(), OT_PREPROCESS
);
465 $dom = $wgParser->preprocessToDom( $text );
466 if ( is_callable( array( $dom, 'saveXML' ) ) ) {
467 $xml = $dom->saveXML();
469 $xml = $dom->__toString();
471 $vals['parsetree'] = $xml;
474 if ( $this->expandTemplates
&& !$this->parseContent
) {
475 $text = $wgParser->preprocess( $text, $title, new ParserOptions() );
477 if ( $this->parseContent
) {
478 global $wgEnableParserCache;
480 $popts = new ParserOptions();
481 $popts->setTidy( true );
483 $articleObj = new Article( $title );
486 $pcache = ParserCache
::singleton();
487 if ( $wgEnableParserCache ) {
488 $p_result = $pcache->get( $articleObj, $popts );
491 $p_result = $wgParser->parse( $text, $title, $popts );
493 if ( $wgEnableParserCache ) {
494 $pcache->save( $p_result, $articleObj, $popts );
498 $text = $p_result->getText();
500 ApiResult
::setContent( $vals, $text );
501 } elseif ( $this->fld_content
) {
502 $vals['texthidden'] = '';
505 if ( !is_null( $this->diffto
) ||
!is_null( $this->difftotext
) ) {
506 global $wgAPIMaxUncachedDiffs;
507 static $n = 0; // Number of uncached diffs we've had
508 if ( $n < $wgAPIMaxUncachedDiffs ) {
509 $vals['diff'] = array();
510 if ( !is_null( $this->difftotext
) ) {
511 $engine = new DifferenceEngine( $title );
512 $engine->setText( $text, $this->difftotext
);
514 $engine = new DifferenceEngine( $title, $revision->getID(), $this->diffto
);
515 $vals['diff']['from'] = $engine->getOldid();
516 $vals['diff']['to'] = $engine->getNewid();
518 $difftext = $engine->getDiffBody();
519 ApiResult
::setContent( $vals['diff'], $difftext );
520 if ( !$engine->wasCacheHit() ) {
524 $vals['diff']['notcached'] = '';
530 public function getCacheMode( $params ) {
531 if ( isset( $params['token'] ) ) {
534 if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) {
535 // formatComment() calls wfMsg() among other things
536 return 'anon-public-user-private';
541 public function getAllowedParams() {
544 ApiBase
::PARAM_ISMULTI
=> true,
545 ApiBase
::PARAM_DFLT
=> 'ids|timestamp|flags|comment|user',
546 ApiBase
::PARAM_TYPE
=> array(
560 ApiBase
::PARAM_TYPE
=> 'limit',
561 ApiBase
::PARAM_MIN
=> 1,
562 ApiBase
::PARAM_MAX
=> ApiBase
::LIMIT_BIG1
,
563 ApiBase
::PARAM_MAX2
=> ApiBase
::LIMIT_BIG2
566 ApiBase
::PARAM_TYPE
=> 'integer'
569 ApiBase
::PARAM_TYPE
=> 'integer'
572 ApiBase
::PARAM_TYPE
=> 'timestamp'
575 ApiBase
::PARAM_TYPE
=> 'timestamp'
578 ApiBase
::PARAM_DFLT
=> 'older',
579 ApiBase
::PARAM_TYPE
=> array(
585 ApiBase
::PARAM_TYPE
=> 'user'
587 'excludeuser' => array(
588 ApiBase
::PARAM_TYPE
=> 'user'
591 'expandtemplates' => false,
592 'generatexml' => false,
596 ApiBase
::PARAM_TYPE
=> array_keys( $this->getTokenFunctions() ),
597 ApiBase
::PARAM_ISMULTI
=> true
601 'difftotext' => null,
605 public function getParamDescription() {
606 $p = $this->getModulePrefix();
609 'Which properties to get for each revision:',
610 ' ids - The ID of the revision',
611 ' flags - Revision flags (minor)',
612 ' timestamp - The timestamp of the revision',
613 ' user - User that made the revision',
614 ' userid - User id of revision creator',
615 ' size - Length of the revision',
616 ' comment - Comment by the user for revision',
617 ' parsedcomment - Parsed comment by the user for the revision',
618 ' content - Text of the revision',
619 ' tags - Tags for the revision',
621 'limit' => 'Limit how many revisions will be returned (enum)',
622 'startid' => 'From which revision id to start enumeration (enum)',
623 'endid' => 'Stop revision enumeration on this revid (enum)',
624 'start' => 'From which revision timestamp to start enumeration (enum)',
625 'end' => 'Enumerate up to this timestamp (enum)',
626 'dir' => 'Direction of enumeration - towards "newer" or "older" revisions (enum)',
627 'user' => 'Only include revisions made by user',
628 'excludeuser' => 'Exclude revisions made by user',
629 'expandtemplates' => 'Expand templates in revision content',
630 'generatexml' => 'Generate XML parse tree for revision content',
631 'parse' => 'Parse revision content. For performance reasons if this option is used, rvlimit is enforced to 1.',
632 'section' => 'Only retrieve the content of this section number',
633 'token' => 'Which tokens to obtain for each revision',
634 'continue' => 'When more results are available, use this to continue',
635 'diffto' => array( 'Revision ID to diff each revision to.',
636 'Use "prev", "next" and "cur" for the previous, next and current revision respectively' ),
637 'difftotext' => array( 'Text to diff each revision to. Only diffs a limited number of revisions.',
638 "Overrides {$p}diffto. If {$p}section is set, only that section will be diffed against this text" ),
639 'tag' => 'Only list revisions tagged with this tag',
643 public function getDescription() {
645 'Get revision information',
646 'This module may be used in several ways:',
647 ' 1) Get data about a set of pages (last revision), by setting titles or pageids parameter',
648 ' 2) Get revisions for one given page, by using titles/pageids with start/end/limit params',
649 ' 3) Get data about a set of revisions by setting their IDs with revids parameter',
650 'All parameters marked as (enum) may only be used with a single page (#2)'
654 public function getPossibleErrors() {
655 return array_merge( parent
::getPossibleErrors(), array(
656 array( 'nosuchrevid', 'diffto' ),
657 array( 'code' => 'revids', 'info' => 'The revids= parameter may not be used with the list options (limit, startid, endid, dirNewer, start, end).' ),
658 array( 'code' => 'multpages', 'info' => 'titles, pageids or a generator was used to supply multiple pages, but the limit, startid, endid, dirNewer, user, excludeuser, start and end parameters may only be used on a single page.' ),
659 array( 'code' => 'diffto', 'info' => 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"' ),
660 array( 'code' => 'badparams', 'info' => 'start and startid cannot be used together' ),
661 array( 'code' => 'badparams', 'info' => 'end and endid cannot be used together' ),
662 array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together' ),
663 array( 'code' => 'nosuchsection', 'info' => 'There is no section section in rID' ),
667 protected function getExamples() {
669 'Get data with content for the last revision of titles "API" and "Main Page":',
670 ' api.php?action=query&prop=revisions&titles=API|Main%20Page&rvprop=timestamp|user|comment|content',
671 'Get last 5 revisions of the "Main Page":',
672 ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment',
673 'Get first 5 revisions of the "Main Page":',
674 ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvdir=newer',
675 'Get first 5 revisions of the "Main Page" made after 2006-05-01:',
676 ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvdir=newer&rvstart=20060501000000',
677 'Get first 5 revisions of the "Main Page" that were not made made by anonymous user "127.0.0.1"',
678 ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvexcludeuser=127.0.0.1',
679 'Get first 5 revisions of the "Main Page" that were made by the user "MediaWiki default"',
680 ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvuser=MediaWiki%20default',
684 public function getVersion() {
685 return __CLASS__
. ': $Id$';