Localisation updates from https://translatewiki.net.
[mediawiki.git] / includes / api / ApiQueryRecentChanges.php
blob14820340ed0e02ce182fe936b8a7b15a4864130d
1 <?php
2 /**
5 * Created on Oct 19, 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
24 * @file
27 /**
28 * A query action to enumerate the recent changes that were done to the wiki.
29 * Various filters are supported.
31 * @ingroup API
33 class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
35 public function __construct( ApiQuery $query, $moduleName ) {
36 parent::__construct( $query, $moduleName, 'rc' );
39 private $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_userid = false,
40 $fld_flags = false, $fld_timestamp = false, $fld_title = false, $fld_ids = false,
41 $fld_sizes = false, $fld_redirect = false, $fld_patrolled = false, $fld_loginfo = false,
42 $fld_tags = false, $fld_sha1 = false, $token = array();
44 private $tokenFunctions;
46 /**
47 * Get an array mapping token names to their handler functions.
48 * The prototype for a token function is func($pageid, $title, $rc)
49 * it should return a token or false (permission denied)
50 * @deprecated since 1.24
51 * @return array Array(tokenname => function)
53 protected function getTokenFunctions() {
54 // Don't call the hooks twice
55 if ( isset( $this->tokenFunctions ) ) {
56 return $this->tokenFunctions;
59 // If we're in a mode that breaks the same-origin policy, no tokens can
60 // be obtained
61 if ( $this->lacksSameOriginSecurity() ) {
62 return array();
65 $this->tokenFunctions = array(
66 'patrol' => array( 'ApiQueryRecentChanges', 'getPatrolToken' )
68 Hooks::run( 'APIQueryRecentChangesTokens', array( &$this->tokenFunctions ) );
70 return $this->tokenFunctions;
73 /**
74 * @deprecated since 1.24
75 * @param int $pageid
76 * @param Title $title
77 * @param RecentChange|null $rc
78 * @return bool|string
80 public static function getPatrolToken( $pageid, $title, $rc = null ) {
81 global $wgUser;
83 $validTokenUser = false;
85 if ( $rc ) {
86 if ( ( $wgUser->useRCPatrol() && $rc->getAttribute( 'rc_type' ) == RC_EDIT ) ||
87 ( $wgUser->useNPPatrol() && $rc->getAttribute( 'rc_type' ) == RC_NEW )
88 ) {
89 $validTokenUser = true;
91 } elseif ( $wgUser->useRCPatrol() || $wgUser->useNPPatrol() ) {
92 $validTokenUser = true;
95 if ( $validTokenUser ) {
96 // The patrol token is always the same, let's exploit that
97 static $cachedPatrolToken = null;
99 if ( is_null( $cachedPatrolToken ) ) {
100 $cachedPatrolToken = $wgUser->getEditToken( 'patrol' );
103 return $cachedPatrolToken;
106 return false;
110 * Sets internal state to include the desired properties in the output.
111 * @param array $prop Associative array of properties, only keys are used here
113 public function initProperties( $prop ) {
114 $this->fld_comment = isset( $prop['comment'] );
115 $this->fld_parsedcomment = isset( $prop['parsedcomment'] );
116 $this->fld_user = isset( $prop['user'] );
117 $this->fld_userid = isset( $prop['userid'] );
118 $this->fld_flags = isset( $prop['flags'] );
119 $this->fld_timestamp = isset( $prop['timestamp'] );
120 $this->fld_title = isset( $prop['title'] );
121 $this->fld_ids = isset( $prop['ids'] );
122 $this->fld_sizes = isset( $prop['sizes'] );
123 $this->fld_redirect = isset( $prop['redirect'] );
124 $this->fld_patrolled = isset( $prop['patrolled'] );
125 $this->fld_loginfo = isset( $prop['loginfo'] );
126 $this->fld_tags = isset( $prop['tags'] );
127 $this->fld_sha1 = isset( $prop['sha1'] );
130 public function execute() {
131 $this->run();
134 public function executeGenerator( $resultPageSet ) {
135 $this->run( $resultPageSet );
139 * Generates and outputs the result of this query based upon the provided parameters.
141 * @param ApiPageSet $resultPageSet
143 public function run( $resultPageSet = null ) {
144 $user = $this->getUser();
145 /* Get the parameters of the request. */
146 $params = $this->extractRequestParams();
148 /* Build our basic query. Namely, something along the lines of:
149 * SELECT * FROM recentchanges WHERE rc_timestamp > $start
150 * AND rc_timestamp < $end AND rc_namespace = $namespace
152 $this->addTables( 'recentchanges' );
153 $index = array( 'recentchanges' => 'rc_timestamp' ); // May change
154 $this->addTimestampWhereRange( 'rc_timestamp', $params['dir'], $params['start'], $params['end'] );
156 if ( !is_null( $params['continue'] ) ) {
157 $cont = explode( '|', $params['continue'] );
158 $this->dieContinueUsageIf( count( $cont ) != 2 );
159 $db = $this->getDB();
160 $timestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
161 $id = intval( $cont[1] );
162 $this->dieContinueUsageIf( $id != $cont[1] );
163 $op = $params['dir'] === 'older' ? '<' : '>';
164 $this->addWhere(
165 "rc_timestamp $op $timestamp OR " .
166 "(rc_timestamp = $timestamp AND " .
167 "rc_id $op= $id)"
171 $order = $params['dir'] === 'older' ? 'DESC' : 'ASC';
172 $this->addOption( 'ORDER BY', array(
173 "rc_timestamp $order",
174 "rc_id $order",
175 ) );
177 $this->addWhereFld( 'rc_namespace', $params['namespace'] );
179 if ( !is_null( $params['type'] ) ) {
180 try {
181 $this->addWhereFld( 'rc_type', RecentChange::parseToRCType( $params['type'] ) );
182 } catch ( Exception $e ) {
183 ApiBase::dieDebug( __METHOD__, $e->getMessage() );
187 if ( !is_null( $params['show'] ) ) {
188 $show = array_flip( $params['show'] );
190 /* Check for conflicting parameters. */
191 if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
192 || ( isset( $show['bot'] ) && isset( $show['!bot'] ) )
193 || ( isset( $show['anon'] ) && isset( $show['!anon'] ) )
194 || ( isset( $show['redirect'] ) && isset( $show['!redirect'] ) )
195 || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
196 || ( isset( $show['patrolled'] ) && isset( $show['unpatrolled'] ) )
197 || ( isset( $show['!patrolled'] ) && isset( $show['unpatrolled'] ) )
199 $this->dieUsageMsg( 'show' );
202 // Check permissions
203 if ( isset( $show['patrolled'] )
204 || isset( $show['!patrolled'] )
205 || isset( $show['unpatrolled'] )
207 if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
208 $this->dieUsage(
209 'You need the patrol right to request the patrolled flag',
210 'permissiondenied'
215 /* Add additional conditions to query depending upon parameters. */
216 $this->addWhereIf( 'rc_minor = 0', isset( $show['!minor'] ) );
217 $this->addWhereIf( 'rc_minor != 0', isset( $show['minor'] ) );
218 $this->addWhereIf( 'rc_bot = 0', isset( $show['!bot'] ) );
219 $this->addWhereIf( 'rc_bot != 0', isset( $show['bot'] ) );
220 $this->addWhereIf( 'rc_user = 0', isset( $show['anon'] ) );
221 $this->addWhereIf( 'rc_user != 0', isset( $show['!anon'] ) );
222 $this->addWhereIf( 'rc_patrolled = 0', isset( $show['!patrolled'] ) );
223 $this->addWhereIf( 'rc_patrolled != 0', isset( $show['patrolled'] ) );
224 $this->addWhereIf( 'page_is_redirect = 1', isset( $show['redirect'] ) );
226 if ( isset( $show['unpatrolled'] ) ) {
227 // See ChangesList:isUnpatrolled
228 if ( $user->useRCPatrol() ) {
229 $this->addWhere( 'rc_patrolled = 0' );
230 } elseif ( $user->useNPPatrol() ) {
231 $this->addWhere( 'rc_patrolled = 0' );
232 $this->addWhereFld( 'rc_type', RC_NEW );
236 // Don't throw log entries out the window here
237 $this->addWhereIf(
238 'page_is_redirect = 0 OR page_is_redirect IS NULL',
239 isset( $show['!redirect'] )
243 if ( !is_null( $params['user'] ) && !is_null( $params['excludeuser'] ) ) {
244 $this->dieUsage( 'user and excludeuser cannot be used together', 'user-excludeuser' );
247 if ( !is_null( $params['user'] ) ) {
248 $this->addWhereFld( 'rc_user_text', $params['user'] );
249 $index['recentchanges'] = 'rc_user_text';
252 if ( !is_null( $params['excludeuser'] ) ) {
253 // We don't use the rc_user_text index here because
254 // * it would require us to sort by rc_user_text before rc_timestamp
255 // * the != condition doesn't throw out too many rows anyway
256 $this->addWhere( 'rc_user_text != ' . $this->getDB()->addQuotes( $params['excludeuser'] ) );
259 /* Add the fields we're concerned with to our query. */
260 $this->addFields( array(
261 'rc_id',
262 'rc_timestamp',
263 'rc_namespace',
264 'rc_title',
265 'rc_cur_id',
266 'rc_type',
267 'rc_deleted'
268 ) );
270 $showRedirects = false;
271 /* Determine what properties we need to display. */
272 if ( !is_null( $params['prop'] ) ) {
273 $prop = array_flip( $params['prop'] );
275 /* Set up internal members based upon params. */
276 $this->initProperties( $prop );
278 if ( $this->fld_patrolled && !$user->useRCPatrol() && !$user->useNPPatrol() ) {
279 $this->dieUsage(
280 'You need the patrol right to request the patrolled flag',
281 'permissiondenied'
285 /* Add fields to our query if they are specified as a needed parameter. */
286 $this->addFieldsIf( array( 'rc_this_oldid', 'rc_last_oldid' ), $this->fld_ids );
287 $this->addFieldsIf( 'rc_comment', $this->fld_comment || $this->fld_parsedcomment );
288 $this->addFieldsIf( 'rc_user', $this->fld_user || $this->fld_userid );
289 $this->addFieldsIf( 'rc_user_text', $this->fld_user );
290 $this->addFieldsIf( array( 'rc_minor', 'rc_type', 'rc_bot' ), $this->fld_flags );
291 $this->addFieldsIf( array( 'rc_old_len', 'rc_new_len' ), $this->fld_sizes );
292 $this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled );
293 $this->addFieldsIf(
294 array( 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ),
295 $this->fld_loginfo
297 $showRedirects = $this->fld_redirect || isset( $show['redirect'] )
298 || isset( $show['!redirect'] );
301 if ( $this->fld_tags ) {
302 $this->addTables( 'tag_summary' );
303 $this->addJoinConds( array( 'tag_summary' => array( 'LEFT JOIN', array( 'rc_id=ts_rc_id' ) ) ) );
304 $this->addFields( 'ts_tags' );
307 if ( $this->fld_sha1 ) {
308 $this->addTables( 'revision' );
309 $this->addJoinConds( array( 'revision' => array( 'LEFT JOIN',
310 array( 'rc_this_oldid=rev_id' ) ) ) );
311 $this->addFields( array( 'rev_sha1', 'rev_deleted' ) );
314 if ( $params['toponly'] || $showRedirects ) {
315 $this->addTables( 'page' );
316 $this->addJoinConds( array( 'page' => array( 'LEFT JOIN',
317 array( 'rc_namespace=page_namespace', 'rc_title=page_title' ) ) ) );
318 $this->addFields( 'page_is_redirect' );
320 if ( $params['toponly'] ) {
321 $this->addWhere( 'rc_this_oldid = page_latest' );
325 if ( !is_null( $params['tag'] ) ) {
326 $this->addTables( 'change_tag' );
327 $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rc_id=ct_rc_id' ) ) ) );
328 $this->addWhereFld( 'ct_tag', $params['tag'] );
331 // Paranoia: avoid brute force searches (bug 17342)
332 if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {
333 if ( !$user->isAllowed( 'deletedhistory' ) ) {
334 $bitmask = Revision::DELETED_USER;
335 } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
336 $bitmask = Revision::DELETED_USER | Revision::DELETED_RESTRICTED;
337 } else {
338 $bitmask = 0;
340 if ( $bitmask ) {
341 $this->addWhere( $this->getDB()->bitAnd( 'rc_deleted', $bitmask ) . " != $bitmask" );
344 if ( $this->getRequest()->getCheck( 'namespace' ) ) {
345 // LogPage::DELETED_ACTION hides the affected page, too.
346 if ( !$user->isAllowed( 'deletedhistory' ) ) {
347 $bitmask = LogPage::DELETED_ACTION;
348 } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
349 $bitmask = LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED;
350 } else {
351 $bitmask = 0;
353 if ( $bitmask ) {
354 $this->addWhere( $this->getDB()->makeList( array(
355 'rc_type != ' . RC_LOG,
356 $this->getDB()->bitAnd( 'rc_deleted', $bitmask ) . " != $bitmask",
357 ), LIST_OR ) );
361 $this->token = $params['token'];
362 $this->addOption( 'LIMIT', $params['limit'] + 1 );
363 $this->addOption( 'USE INDEX', $index );
365 $count = 0;
366 /* Perform the actual query. */
367 $res = $this->select( __METHOD__ );
369 $titles = array();
371 $result = $this->getResult();
373 /* Iterate through the rows, adding data extracted from them to our query result. */
374 foreach ( $res as $row ) {
375 if ( ++$count > $params['limit'] ) {
376 // We've reached the one extra which shows that there are
377 // additional pages to be had. Stop here...
378 $this->setContinueEnumParameter( 'continue', "$row->rc_timestamp|$row->rc_id" );
379 break;
382 if ( is_null( $resultPageSet ) ) {
383 /* Extract the data from a single row. */
384 $vals = $this->extractRowInfo( $row );
386 /* Add that row's data to our final output. */
387 if ( !$vals ) {
388 continue;
390 $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals );
391 if ( !$fit ) {
392 $this->setContinueEnumParameter( 'continue', "$row->rc_timestamp|$row->rc_id" );
393 break;
395 } else {
396 $titles[] = Title::makeTitle( $row->rc_namespace, $row->rc_title );
400 if ( is_null( $resultPageSet ) ) {
401 /* Format the result */
402 $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'rc' );
403 } else {
404 $resultPageSet->populateFromTitles( $titles );
409 * Extracts from a single sql row the data needed to describe one recent change.
411 * @param stdClass $row The row from which to extract the data.
412 * @return array An array mapping strings (descriptors) to their respective string values.
413 * @access public
415 public function extractRowInfo( $row ) {
416 /* Determine the title of the page that has been changed. */
417 $title = Title::makeTitle( $row->rc_namespace, $row->rc_title );
418 $user = $this->getUser();
420 /* Our output data. */
421 $vals = array();
423 $type = intval( $row->rc_type );
424 $vals['type'] = RecentChange::parseFromRCType( $type );
426 $anyHidden = false;
428 /* Create a new entry in the result for the title. */
429 if ( $this->fld_title || $this->fld_ids ) {
430 if ( $type === RC_LOG && ( $row->rc_deleted & LogPage::DELETED_ACTION ) ) {
431 $vals['actionhidden'] = '';
432 $anyHidden = true;
434 if ( $type !== RC_LOG ||
435 LogEventsList::userCanBitfield( $row->rc_deleted, LogPage::DELETED_ACTION, $user )
437 if ( $this->fld_title ) {
438 ApiQueryBase::addTitleInfo( $vals, $title );
440 if ( $this->fld_ids ) {
441 $vals['pageid'] = intval( $row->rc_cur_id );
442 $vals['revid'] = intval( $row->rc_this_oldid );
443 $vals['old_revid'] = intval( $row->rc_last_oldid );
448 if ( $this->fld_ids ) {
449 $vals['rcid'] = intval( $row->rc_id );
452 /* Add user data and 'anon' flag, if user is anonymous. */
453 if ( $this->fld_user || $this->fld_userid ) {
454 if ( $row->rc_deleted & Revision::DELETED_USER ) {
455 $vals['userhidden'] = '';
456 $anyHidden = true;
458 if ( Revision::userCanBitfield( $row->rc_deleted, Revision::DELETED_USER, $user ) ) {
459 if ( $this->fld_user ) {
460 $vals['user'] = $row->rc_user_text;
463 if ( $this->fld_userid ) {
464 $vals['userid'] = $row->rc_user;
467 if ( !$row->rc_user ) {
468 $vals['anon'] = '';
473 /* Add flags, such as new, minor, bot. */
474 if ( $this->fld_flags ) {
475 if ( $row->rc_bot ) {
476 $vals['bot'] = '';
478 if ( $row->rc_type == RC_NEW ) {
479 $vals['new'] = '';
481 if ( $row->rc_minor ) {
482 $vals['minor'] = '';
486 /* Add sizes of each revision. (Only available on 1.10+) */
487 if ( $this->fld_sizes ) {
488 $vals['oldlen'] = intval( $row->rc_old_len );
489 $vals['newlen'] = intval( $row->rc_new_len );
492 /* Add the timestamp. */
493 if ( $this->fld_timestamp ) {
494 $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->rc_timestamp );
497 /* Add edit summary / log summary. */
498 if ( $this->fld_comment || $this->fld_parsedcomment ) {
499 if ( $row->rc_deleted & Revision::DELETED_COMMENT ) {
500 $vals['commenthidden'] = '';
501 $anyHidden = true;
503 if ( Revision::userCanBitfield( $row->rc_deleted, Revision::DELETED_COMMENT, $user ) ) {
504 if ( $this->fld_comment && isset( $row->rc_comment ) ) {
505 $vals['comment'] = $row->rc_comment;
508 if ( $this->fld_parsedcomment && isset( $row->rc_comment ) ) {
509 $vals['parsedcomment'] = Linker::formatComment( $row->rc_comment, $title );
514 if ( $this->fld_redirect ) {
515 if ( $row->page_is_redirect ) {
516 $vals['redirect'] = '';
520 /* Add the patrolled flag */
521 if ( $this->fld_patrolled && $row->rc_patrolled == 1 ) {
522 $vals['patrolled'] = '';
525 if ( $this->fld_patrolled && ChangesList::isUnpatrolled( $row, $user ) ) {
526 $vals['unpatrolled'] = '';
529 if ( $this->fld_loginfo && $row->rc_type == RC_LOG ) {
530 if ( $row->rc_deleted & LogPage::DELETED_ACTION ) {
531 $vals['actionhidden'] = '';
532 $anyHidden = true;
534 if ( LogEventsList::userCanBitfield( $row->rc_deleted, LogPage::DELETED_ACTION, $user ) ) {
535 $vals['logid'] = intval( $row->rc_logid );
536 $vals['logtype'] = $row->rc_log_type;
537 $vals['logaction'] = $row->rc_log_action;
538 $logEntry = DatabaseLogEntry::newFromRow( $row );
539 ApiQueryLogEvents::addLogParams(
540 $this->getResult(),
541 $vals,
542 $logEntry->getParameters(),
543 $logEntry->getType(),
544 $logEntry->getSubtype(),
545 $logEntry->getTimestamp()
550 if ( $this->fld_tags ) {
551 if ( $row->ts_tags ) {
552 $tags = explode( ',', $row->ts_tags );
553 $this->getResult()->setIndexedTagName( $tags, 'tag' );
554 $vals['tags'] = $tags;
555 } else {
556 $vals['tags'] = array();
560 if ( $this->fld_sha1 && $row->rev_sha1 !== null ) {
561 if ( $row->rev_deleted & Revision::DELETED_TEXT ) {
562 $vals['sha1hidden'] = '';
563 $anyHidden = true;
565 if ( Revision::userCanBitfield( $row->rev_deleted, Revision::DELETED_TEXT, $user ) ) {
566 if ( $row->rev_sha1 !== '' ) {
567 $vals['sha1'] = wfBaseConvert( $row->rev_sha1, 36, 16, 40 );
568 } else {
569 $vals['sha1'] = '';
574 if ( !is_null( $this->token ) ) {
575 $tokenFunctions = $this->getTokenFunctions();
576 foreach ( $this->token as $t ) {
577 $val = call_user_func( $tokenFunctions[$t], $row->rc_cur_id,
578 $title, RecentChange::newFromRow( $row ) );
579 if ( $val === false ) {
580 $this->setWarning( "Action '$t' is not allowed for the current user" );
581 } else {
582 $vals[$t . 'token'] = $val;
587 if ( $anyHidden && ( $row->rc_deleted & Revision::DELETED_RESTRICTED ) ) {
588 $vals['suppressed'] = '';
591 return $vals;
594 public function getCacheMode( $params ) {
595 if ( isset( $params['show'] ) ) {
596 foreach ( $params['show'] as $show ) {
597 if ( $show === 'patrolled' || $show === '!patrolled' ) {
598 return 'private';
602 if ( isset( $params['token'] ) ) {
603 return 'private';
605 if ( $this->userCanSeeRevDel() ) {
606 return 'private';
608 if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) {
609 // formatComment() calls wfMessage() among other things
610 return 'anon-public-user-private';
613 return 'public';
616 public function getAllowedParams() {
617 return array(
618 'start' => array(
619 ApiBase::PARAM_TYPE => 'timestamp'
621 'end' => array(
622 ApiBase::PARAM_TYPE => 'timestamp'
624 'dir' => array(
625 ApiBase::PARAM_DFLT => 'older',
626 ApiBase::PARAM_TYPE => array(
627 'newer',
628 'older'
630 ApiBase::PARAM_HELP_MSG => 'api-help-param-direction',
632 'namespace' => array(
633 ApiBase::PARAM_ISMULTI => true,
634 ApiBase::PARAM_TYPE => 'namespace'
636 'user' => array(
637 ApiBase::PARAM_TYPE => 'user'
639 'excludeuser' => array(
640 ApiBase::PARAM_TYPE => 'user'
642 'tag' => null,
643 'prop' => array(
644 ApiBase::PARAM_ISMULTI => true,
645 ApiBase::PARAM_DFLT => 'title|timestamp|ids',
646 ApiBase::PARAM_TYPE => array(
647 'user',
648 'userid',
649 'comment',
650 'parsedcomment',
651 'flags',
652 'timestamp',
653 'title',
654 'ids',
655 'sizes',
656 'redirect',
657 'patrolled',
658 'loginfo',
659 'tags',
660 'sha1',
663 'token' => array(
664 ApiBase::PARAM_DEPRECATED => true,
665 ApiBase::PARAM_TYPE => array_keys( $this->getTokenFunctions() ),
666 ApiBase::PARAM_ISMULTI => true
668 'show' => array(
669 ApiBase::PARAM_ISMULTI => true,
670 ApiBase::PARAM_TYPE => array(
671 'minor',
672 '!minor',
673 'bot',
674 '!bot',
675 'anon',
676 '!anon',
677 'redirect',
678 '!redirect',
679 'patrolled',
680 '!patrolled',
681 'unpatrolled'
684 'limit' => array(
685 ApiBase::PARAM_DFLT => 10,
686 ApiBase::PARAM_TYPE => 'limit',
687 ApiBase::PARAM_MIN => 1,
688 ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
689 ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
691 'type' => array(
692 ApiBase::PARAM_DFLT => 'edit|new|log',
693 ApiBase::PARAM_ISMULTI => true,
694 ApiBase::PARAM_TYPE => array(
695 'edit',
696 'external',
697 'new',
698 'log'
701 'toponly' => false,
702 'continue' => array(
703 ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
708 protected function getExamplesMessages() {
709 return array(
710 'action=query&list=recentchanges'
711 => 'apihelp-query+recentchanges-example-simple',
712 'action=query&generator=recentchanges&grcshow=!patrolled&prop=info'
713 => 'apihelp-query+recentchanges-example-generator',
717 public function getHelpUrls() {
718 return 'https://www.mediawiki.org/wiki/API:Recentchanges';