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 Token
::prepare(
83 array( $title->getPrefixedText(), $rev->getUserText() )
87 public function execute() {
88 $params = $this->extractRequestParams( false );
90 // If any of those parameters are used, work in 'enumeration' mode.
91 // Enum mode can only be used when exactly one page is provided.
92 // Enumerating revisions on multiple pages make it extremely
93 // difficult to manage continuations and require additional SQL indexes
94 $enumRevMode = ( !is_null( $params['user'] ) ||
!is_null( $params['excludeuser'] ) ||
95 !is_null( $params['limit'] ) ||
!is_null( $params['startid'] ) ||
96 !is_null( $params['endid'] ) ||
$params['dir'] === 'newer' ||
97 !is_null( $params['start'] ) ||
!is_null( $params['end'] ) );
100 $pageSet = $this->getPageSet();
101 $pageCount = $pageSet->getGoodTitleCount();
102 $revCount = $pageSet->getRevisionCount();
104 // Optimization -- nothing to do
105 if ( $revCount === 0 && $pageCount === 0 ) {
109 if ( $revCount > 0 && $enumRevMode ) {
110 $this->dieUsage( 'The revids= parameter may not be used with the list options (limit, startid, endid, dirNewer, start, end).', 'revids' );
113 if ( $pageCount > 1 && $enumRevMode ) {
114 $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' );
117 if ( !is_null( $params['difftotext'] ) ) {
118 $this->difftotext
= $params['difftotext'];
119 } elseif ( !is_null( $params['diffto'] ) ) {
120 if ( $params['diffto'] == 'cur' ) {
121 $params['diffto'] = 0;
123 if ( ( !ctype_digit( $params['diffto'] ) ||
$params['diffto'] < 0 )
124 && $params['diffto'] != 'prev' && $params['diffto'] != 'next' )
126 $this->dieUsage( 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"', 'diffto' );
128 // Check whether the revision exists and is readable,
129 // DifferenceEngine returns a rather ambiguous empty
130 // string if that's not the case
131 if ( $params['diffto'] != 0 ) {
132 $difftoRev = Revision
::newFromID( $params['diffto'] );
134 $this->dieUsageMsg( array( 'nosuchrevid', $params['diffto'] ) );
136 if ( !$difftoRev->userCan( Revision
::DELETED_TEXT
) ) {
137 $this->setWarning( "Couldn't diff to r{$difftoRev->getID()}: content is hidden" );
138 $params['diffto'] = null;
141 $this->diffto
= $params['diffto'];
144 $db = $this->getDB();
145 $this->addTables( 'page' );
146 $this->addFields( Revision
::selectFields() );
147 $this->addWhere( 'page_id = rev_page' );
149 $prop = array_flip( $params['prop'] );
152 $this->fld_ids
= isset ( $prop['ids'] );
153 // $this->addFieldsIf('rev_text_id', $this->fld_ids); // should this be exposed?
154 $this->fld_flags
= isset ( $prop['flags'] );
155 $this->fld_timestamp
= isset ( $prop['timestamp'] );
156 $this->fld_comment
= isset ( $prop['comment'] );
157 $this->fld_parsedcomment
= isset ( $prop['parsedcomment'] );
158 $this->fld_size
= isset ( $prop['size'] );
159 $this->fld_userid
= isset( $prop['userid'] );
160 $this->fld_user
= isset ( $prop['user'] );
161 $this->token
= $params['token'];
163 // Possible indexes used
166 $userMax = ( $this->fld_content ? ApiBase
::LIMIT_SML1
: ApiBase
::LIMIT_BIG1
);
167 $botMax = ( $this->fld_content ? ApiBase
::LIMIT_SML2
: ApiBase
::LIMIT_BIG2
);
168 $limit = $params['limit'];
169 if ( $limit == 'max' ) {
170 $limit = $this->getMain()->canApiHighLimits() ?
$botMax : $userMax;
171 $this->getResult()->setParsedLimit( $this->getModuleName(), $limit );
175 if ( !is_null( $this->token
) ||
$pageCount > 0 ) {
176 $this->addFields( Revision
::selectPageFields() );
179 if ( isset( $prop['tags'] ) ) {
180 $this->fld_tags
= true;
181 $this->addTables( 'tag_summary' );
182 $this->addJoinConds( array( 'tag_summary' => array( 'LEFT JOIN', array( 'rev_id=ts_rev_id' ) ) ) );
183 $this->addFields( 'ts_tags' );
186 if ( !is_null( $params['tag'] ) ) {
187 $this->addTables( 'change_tag' );
188 $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) );
189 $this->addWhereFld( 'ct_tag' , $params['tag'] );
190 global $wgOldChangeTagsIndex;
191 $index['change_tag'] = $wgOldChangeTagsIndex ?
'ct_tag' : 'change_tag_tag_id';
194 if ( isset( $prop['content'] ) ||
!is_null( $this->difftotext
) ) {
195 // For each page we will request, the user must have read rights for that page
196 foreach ( $pageSet->getGoodTitles() as $title ) {
197 if ( !$title->userCanRead() ) {
199 'The current user is not allowed to read ' . $title->getPrefixedText(),
204 $this->addTables( 'text' );
205 $this->addWhere( 'rev_text_id=old_id' );
206 $this->addFields( 'old_id' );
207 $this->addFields( Revision
::selectTextFields() );
209 $this->fld_content
= isset( $prop['content'] );
211 $this->expandTemplates
= $params['expandtemplates'];
212 $this->generateXML
= $params['generatexml'];
213 $this->parseContent
= $params['parse'];
214 if ( $this->parseContent
) {
215 // Must manually initialize unset limit
216 if ( is_null( $limit ) ) {
219 // We are only going to parse 1 revision per request
220 $this->validateLimit( 'limit', $limit, 1, 1, 1 );
222 if ( isset( $params['section'] ) ) {
223 $this->section
= $params['section'];
225 $this->section
= false;
229 //Bug 24166 - API error when using rvprop=tags
230 $this->addTables( 'revision' );
233 if ( $enumRevMode ) {
234 // This is mostly to prevent parameter errors (and optimize SQL?)
235 if ( !is_null( $params['startid'] ) && !is_null( $params['start'] ) ) {
236 $this->dieUsage( 'start and startid cannot be used together', 'badparams' );
239 if ( !is_null( $params['endid'] ) && !is_null( $params['end'] ) ) {
240 $this->dieUsage( 'end and endid cannot be used together', 'badparams' );
243 if ( !is_null( $params['user'] ) && !is_null( $params['excludeuser'] ) ) {
244 $this->dieUsage( 'user and excludeuser cannot be used together', 'badparams' );
247 // This code makes an assumption that sorting by rev_id and rev_timestamp produces
248 // the same result. This way users may request revisions starting at a given time,
249 // but to page through results use the rev_id returned after each page.
250 // Switching to rev_id removes the potential problem of having more than
251 // one row with the same timestamp for the same page.
252 // The order needs to be the same as start parameter to avoid SQL filesort.
253 if ( is_null( $params['startid'] ) && is_null( $params['endid'] ) ) {
254 $this->addWhereRange( 'rev_timestamp', $params['dir'],
255 $params['start'], $params['end'] );
257 $this->addWhereRange( 'rev_id', $params['dir'],
258 $params['startid'], $params['endid'] );
259 // One of start and end can be set
260 // If neither is set, this does nothing
261 $this->addWhereRange( 'rev_timestamp', $params['dir'],
262 $params['start'], $params['end'], false );
265 // must manually initialize unset limit
266 if ( is_null( $limit ) ) {
269 $this->validateLimit( 'limit', $limit, 1, $userMax, $botMax );
271 // There is only one ID, use it
272 $ids = array_keys( $pageSet->getGoodTitles() );
273 $this->addWhereFld( 'rev_page', reset( $ids ) );
275 if ( !is_null( $params['user'] ) ) {
276 $this->addWhereFld( 'rev_user_text', $params['user'] );
277 } elseif ( !is_null( $params['excludeuser'] ) ) {
278 $this->addWhere( 'rev_user_text != ' .
279 $db->addQuotes( $params['excludeuser'] ) );
281 if ( !is_null( $params['user'] ) ||
!is_null( $params['excludeuser'] ) ) {
282 // Paranoia: avoid brute force searches (bug 17342)
283 $this->addWhere( $db->bitAnd( 'rev_deleted', Revision
::DELETED_USER
) . ' = 0' );
285 } elseif ( $revCount > 0 ) {
286 $max = $this->getMain()->canApiHighLimits() ?
$botMax : $userMax;
287 $revs = $pageSet->getRevisionIDs();
288 if ( self
::truncateArray( $revs, $max ) ) {
289 $this->setWarning( "Too many values supplied for parameter 'revids': the limit is $max" );
292 // Get all revision IDs
293 $this->addWhereFld( 'rev_id', array_keys( $revs ) );
295 if ( !is_null( $params['continue'] ) ) {
296 $this->addWhere( "rev_id >= '" . intval( $params['continue'] ) . "'" );
298 $this->addOption( 'ORDER BY', 'rev_id' );
300 // assumption testing -- we should never get more then $revCount rows.
302 } elseif ( $pageCount > 0 ) {
303 $max = $this->getMain()->canApiHighLimits() ?
$botMax : $userMax;
304 $titles = $pageSet->getGoodTitles();
305 if ( self
::truncateArray( $titles, $max ) ) {
306 $this->setWarning( "Too many values supplied for parameter 'titles': the limit is $max" );
309 // When working in multi-page non-enumeration mode,
310 // limit to the latest revision only
311 $this->addWhere( 'page_id=rev_page' );
312 $this->addWhere( 'page_latest=rev_id' );
315 $this->addWhereFld( 'page_id', array_keys( $titles ) );
316 // Every time someone relies on equality propagation, god kills a kitten :)
317 $this->addWhereFld( 'rev_page', array_keys( $titles ) );
319 if ( !is_null( $params['continue'] ) ) {
320 $cont = explode( '|', $params['continue'] );
321 if ( count( $cont ) != 2 ) {
322 $this->dieUsage( 'Invalid continue param. You should pass the original ' .
323 'value returned by the previous query', '_badcontinue' );
325 $pageid = intval( $cont[0] );
326 $revid = intval( $cont[1] );
328 "rev_page > '$pageid' OR " .
329 "(rev_page = '$pageid' AND " .
330 "rev_id >= '$revid')"
333 $this->addOption( 'ORDER BY', 'rev_page, rev_id' );
335 // assumption testing -- we should never get more then $pageCount rows.
338 ApiBase
::dieDebug( __METHOD__
, 'param validation?' );
341 $this->addOption( 'LIMIT', $limit +
1 );
342 $this->addOption( 'USE INDEX', $index );
345 $res = $this->select( __METHOD__
);
347 foreach ( $res as $row ) {
348 if ( ++
$count > $limit ) {
349 // We've reached the one extra which shows that there are additional pages to be had. Stop here...
350 if ( !$enumRevMode ) {
351 ApiBase
::dieDebug( __METHOD__
, 'Got more rows then expected' ); // bug report
353 $this->setContinueEnumParameter( 'startid', intval( $row->rev_id
) );
357 $fit = $this->addPageSubItem( $row->rev_page
, $this->extractRowInfo( $row ), 'rev' );
359 if ( $enumRevMode ) {
360 $this->setContinueEnumParameter( 'startid', intval( $row->rev_id
) );
361 } elseif ( $revCount > 0 ) {
362 $this->setContinueEnumParameter( 'continue', intval( $row->rev_id
) );
364 $this->setContinueEnumParameter( 'continue', intval( $row->rev_page
) .
365 '|' . intval( $row->rev_id
) );
372 private function extractRowInfo( $row ) {
373 $revision = new Revision( $row );
374 $title = $revision->getTitle();
377 if ( $this->fld_ids
) {
378 $vals['revid'] = intval( $revision->getId() );
379 // $vals['oldid'] = intval( $row->rev_text_id ); // todo: should this be exposed?
380 if ( !is_null( $revision->getParentId() ) ) {
381 $vals['parentid'] = intval( $revision->getParentId() );
385 if ( $this->fld_flags
&& $revision->isMinor() ) {
389 if ( $this->fld_user ||
$this->fld_userid
) {
390 if ( $revision->isDeleted( Revision
::DELETED_USER
) ) {
391 $vals['userhidden'] = '';
393 if ( $this->fld_user
) {
394 $vals['user'] = $revision->getUserText();
396 $userid = $revision->getUser();
401 if ( $this->fld_userid
) {
402 $vals['userid'] = $userid;
407 if ( $this->fld_timestamp
) {
408 $vals['timestamp'] = wfTimestamp( TS_ISO_8601
, $revision->getTimestamp() );
411 if ( $this->fld_size
&& !is_null( $revision->getSize() ) ) {
412 $vals['size'] = intval( $revision->getSize() );
415 if ( $this->fld_comment ||
$this->fld_parsedcomment
) {
416 if ( $revision->isDeleted( Revision
::DELETED_COMMENT
) ) {
417 $vals['commenthidden'] = '';
419 $comment = $revision->getComment();
421 if ( $this->fld_comment
) {
422 $vals['comment'] = $comment;
425 if ( $this->fld_parsedcomment
) {
427 $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $comment, $title );
432 if ( $this->fld_tags
) {
433 if ( $row->ts_tags
) {
434 $tags = explode( ',', $row->ts_tags
);
435 $this->getResult()->setIndexedTagName( $tags, 'tag' );
436 $vals['tags'] = $tags;
438 $vals['tags'] = array();
442 if ( !is_null( $this->token
) ) {
443 $tokenFunctions = $this->getTokenFunctions();
444 foreach ( $this->token
as $t ) {
445 $val = call_user_func( $tokenFunctions[$t], $title->getArticleID(), $title, $revision );
446 if ( $val === false ) {
447 $this->setWarning( "Action '$t' is not allowed for the current user" );
449 $vals[$t . 'token'] = $val;
456 if ( $this->fld_content ||
!is_null( $this->difftotext
) ) {
457 $text = $revision->getText();
458 // Expand templates after getting section content because
459 // template-added sections don't count and Parser::preprocess()
460 // will have less input
461 if ( $this->section
!== false ) {
462 $text = $wgParser->getSection( $text, $this->section
, false );
463 if ( $text === false ) {
464 $this->dieUsage( "There is no section {$this->section} in r" . $revision->getId(), 'nosuchsection' );
468 if ( $this->fld_content
&& !$revision->isDeleted( Revision
::DELETED_TEXT
) ) {
469 if ( $this->generateXML
) {
470 $wgParser->startExternalParse( $title, new ParserOptions(), OT_PREPROCESS
);
471 $dom = $wgParser->preprocessToDom( $text );
472 if ( is_callable( array( $dom, 'saveXML' ) ) ) {
473 $xml = $dom->saveXML();
475 $xml = $dom->__toString();
477 $vals['parsetree'] = $xml;
480 if ( $this->expandTemplates
&& !$this->parseContent
) {
481 $text = $wgParser->preprocess( $text, $title, new ParserOptions() );
483 if ( $this->parseContent
) {
484 global $wgEnableParserCache;
486 $popts = new ParserOptions();
487 $popts->setTidy( true );
489 $articleObj = new Article( $title );
492 $pcache = ParserCache
::singleton();
493 if ( $wgEnableParserCache ) {
494 $p_result = $pcache->get( $articleObj, $popts );
497 $p_result = $wgParser->parse( $text, $title, $popts );
499 if ( $wgEnableParserCache ) {
500 $pcache->save( $p_result, $articleObj, $popts );
504 $text = $p_result->getText();
506 ApiResult
::setContent( $vals, $text );
507 } elseif ( $this->fld_content
) {
508 $vals['texthidden'] = '';
511 if ( !is_null( $this->diffto
) ||
!is_null( $this->difftotext
) ) {
512 global $wgAPIMaxUncachedDiffs;
513 static $n = 0; // Number of uncached diffs we've had
514 if ( $n < $wgAPIMaxUncachedDiffs ) {
515 $vals['diff'] = array();
516 if ( !is_null( $this->difftotext
) ) {
517 $engine = new DifferenceEngine( $title );
518 $engine->setText( $text, $this->difftotext
);
520 $engine = new DifferenceEngine( $title, $revision->getID(), $this->diffto
);
521 $vals['diff']['from'] = $engine->getOldid();
522 $vals['diff']['to'] = $engine->getNewid();
524 $difftext = $engine->getDiffBody();
525 ApiResult
::setContent( $vals['diff'], $difftext );
526 if ( !$engine->wasCacheHit() ) {
530 $vals['diff']['notcached'] = '';
536 public function getCacheMode( $params ) {
537 if ( isset( $params['token'] ) ) {
540 if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) {
541 // formatComment() calls wfMsg() among other things
542 return 'anon-public-user-private';
547 public function getAllowedParams() {
550 ApiBase
::PARAM_ISMULTI
=> true,
551 ApiBase
::PARAM_DFLT
=> 'ids|timestamp|flags|comment|user',
552 ApiBase
::PARAM_TYPE
=> array(
566 ApiBase
::PARAM_TYPE
=> 'limit',
567 ApiBase
::PARAM_MIN
=> 1,
568 ApiBase
::PARAM_MAX
=> ApiBase
::LIMIT_BIG1
,
569 ApiBase
::PARAM_MAX2
=> ApiBase
::LIMIT_BIG2
572 ApiBase
::PARAM_TYPE
=> 'integer'
575 ApiBase
::PARAM_TYPE
=> 'integer'
578 ApiBase
::PARAM_TYPE
=> 'timestamp'
581 ApiBase
::PARAM_TYPE
=> 'timestamp'
584 ApiBase
::PARAM_DFLT
=> 'older',
585 ApiBase
::PARAM_TYPE
=> array(
591 ApiBase
::PARAM_TYPE
=> 'user'
593 'excludeuser' => array(
594 ApiBase
::PARAM_TYPE
=> 'user'
597 'expandtemplates' => false,
598 'generatexml' => false,
602 ApiBase
::PARAM_TYPE
=> array_keys( $this->getTokenFunctions() ),
603 ApiBase
::PARAM_ISMULTI
=> true
607 'difftotext' => null,
611 public function getParamDescription() {
612 $p = $this->getModulePrefix();
615 'Which properties to get for each revision:',
616 ' ids - The ID of the revision',
617 ' flags - Revision flags (minor)',
618 ' timestamp - The timestamp of the revision',
619 ' user - User that made the revision',
620 ' userid - User id of revision creator',
621 ' size - Length of the revision',
622 ' comment - Comment by the user for revision',
623 ' parsedcomment - Parsed comment by the user for the revision',
624 ' content - Text of the revision',
625 ' tags - Tags for the revision',
627 'limit' => 'Limit how many revisions will be returned (enum)',
628 'startid' => 'From which revision id to start enumeration (enum)',
629 'endid' => 'Stop revision enumeration on this revid (enum)',
630 'start' => 'From which revision timestamp to start enumeration (enum)',
631 'end' => 'Enumerate up to this timestamp (enum)',
632 'dir' => 'Direction of enumeration - towards "newer" or "older" revisions (enum)',
633 'user' => 'Only include revisions made by user',
634 'excludeuser' => 'Exclude revisions made by user',
635 'expandtemplates' => 'Expand templates in revision content',
636 'generatexml' => 'Generate XML parse tree for revision content',
637 'parse' => 'Parse revision content. For performance reasons if this option is used, rvlimit is enforced to 1.',
638 'section' => 'Only retrieve the content of this section number',
639 'token' => 'Which tokens to obtain for each revision',
640 'continue' => 'When more results are available, use this to continue',
641 'diffto' => array( 'Revision ID to diff each revision to.',
642 'Use "prev", "next" and "cur" for the previous, next and current revision respectively' ),
643 'difftotext' => array( 'Text to diff each revision to. Only diffs a limited number of revisions.',
644 "Overrides {$p}diffto. If {$p}section is set, only that section will be diffed against this text" ),
645 'tag' => 'Only list revisions tagged with this tag',
649 public function getDescription() {
651 'Get revision information',
652 'This module may be used in several ways:',
653 ' 1) Get data about a set of pages (last revision), by setting titles or pageids parameter',
654 ' 2) Get revisions for one given page, by using titles/pageids with start/end/limit params',
655 ' 3) Get data about a set of revisions by setting their IDs with revids parameter',
656 'All parameters marked as (enum) may only be used with a single page (#2)'
660 public function getPossibleErrors() {
661 return array_merge( parent
::getPossibleErrors(), array(
662 array( 'nosuchrevid', 'diffto' ),
663 array( 'code' => 'revids', 'info' => 'The revids= parameter may not be used with the list options (limit, startid, endid, dirNewer, start, end).' ),
664 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.' ),
665 array( 'code' => 'diffto', 'info' => 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"' ),
666 array( 'code' => 'badparams', 'info' => 'start and startid cannot be used together' ),
667 array( 'code' => 'badparams', 'info' => 'end and endid cannot be used together' ),
668 array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together' ),
669 array( 'code' => 'nosuchsection', 'info' => 'There is no section section in rID' ),
673 protected function getExamples() {
675 'Get data with content for the last revision of titles "API" and "Main Page":',
676 ' api.php?action=query&prop=revisions&titles=API|Main%20Page&rvprop=timestamp|user|comment|content',
677 'Get last 5 revisions of the "Main Page":',
678 ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment',
679 'Get first 5 revisions of the "Main Page":',
680 ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvdir=newer',
681 'Get first 5 revisions of the "Main Page" made after 2006-05-01:',
682 ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvdir=newer&rvstart=20060501000000',
683 'Get first 5 revisions of the "Main Page" that were not made made by anonymous user "127.0.0.1"',
684 ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvexcludeuser=127.0.0.1',
685 'Get first 5 revisions of the "Main Page" that were made by the user "MediaWiki default"',
686 ' api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvuser=MediaWiki%20default',
690 public function getVersion() {
691 return __CLASS__
. ': $Id$';