3 * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
23 use MediaWiki\MediaWikiServices
;
24 use MediaWiki\Revision\RevisionRecord
;
25 use MediaWiki\Storage\NameTableAccessException
;
28 * A query action to enumerate the recent changes that were done to the wiki.
29 * Various filters are supported.
33 class ApiQueryRecentChanges
extends ApiQueryGeneratorBase
{
35 public function __construct( ApiQuery
$query, $moduleName ) {
36 parent
::__construct( $query, $moduleName, 'rc' );
39 private $commentStore;
41 private $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_userid = false,
42 $fld_flags = false, $fld_timestamp = false, $fld_title = false, $fld_ids = false,
43 $fld_sizes = false, $fld_redirect = false, $fld_patrolled = false, $fld_loginfo = false,
44 $fld_tags = false, $fld_sha1 = false, $token = [];
46 private $tokenFunctions;
49 * Get an array mapping token names to their handler functions.
50 * The prototype for a token function is func($pageid, $title, $rc)
51 * it should return a token or false (permission denied)
52 * @deprecated since 1.24
53 * @return array [ tokenname => function ]
55 protected function getTokenFunctions() {
56 // Don't call the hooks twice
57 if ( isset( $this->tokenFunctions
) ) {
58 return $this->tokenFunctions
;
61 // If we're in a mode that breaks the same-origin policy, no tokens can
63 if ( $this->lacksSameOriginSecurity() ) {
67 $this->tokenFunctions
= [
68 'patrol' => [ self
::class, 'getPatrolToken' ]
70 Hooks
::run( 'APIQueryRecentChangesTokens', [ &$this->tokenFunctions
] );
72 return $this->tokenFunctions
;
76 * @deprecated since 1.24
79 * @param RecentChange|null $rc
82 public static function getPatrolToken( $pageid, $title, $rc = null ) {
85 $validTokenUser = false;
88 if ( ( $wgUser->useRCPatrol() && $rc->getAttribute( 'rc_type' ) == RC_EDIT
) ||
89 ( $wgUser->useNPPatrol() && $rc->getAttribute( 'rc_type' ) == RC_NEW
)
91 $validTokenUser = true;
93 } elseif ( $wgUser->useRCPatrol() ||
$wgUser->useNPPatrol() ) {
94 $validTokenUser = true;
97 if ( $validTokenUser ) {
98 // The patrol token is always the same, let's exploit that
99 static $cachedPatrolToken = null;
101 if ( is_null( $cachedPatrolToken ) ) {
102 $cachedPatrolToken = $wgUser->getEditToken( 'patrol' );
105 return $cachedPatrolToken;
112 * Sets internal state to include the desired properties in the output.
113 * @param array $prop Associative array of properties, only keys are used here
115 public function initProperties( $prop ) {
116 $this->fld_comment
= isset( $prop['comment'] );
117 $this->fld_parsedcomment
= isset( $prop['parsedcomment'] );
118 $this->fld_user
= isset( $prop['user'] );
119 $this->fld_userid
= isset( $prop['userid'] );
120 $this->fld_flags
= isset( $prop['flags'] );
121 $this->fld_timestamp
= isset( $prop['timestamp'] );
122 $this->fld_title
= isset( $prop['title'] );
123 $this->fld_ids
= isset( $prop['ids'] );
124 $this->fld_sizes
= isset( $prop['sizes'] );
125 $this->fld_redirect
= isset( $prop['redirect'] );
126 $this->fld_patrolled
= isset( $prop['patrolled'] );
127 $this->fld_loginfo
= isset( $prop['loginfo'] );
128 $this->fld_tags
= isset( $prop['tags'] );
129 $this->fld_sha1
= isset( $prop['sha1'] );
132 public function execute() {
136 public function executeGenerator( $resultPageSet ) {
137 $this->run( $resultPageSet );
141 * Generates and outputs the result of this query based upon the provided parameters.
143 * @param ApiPageSet|null $resultPageSet
145 public function run( $resultPageSet = null ) {
146 global $wgChangeTagsSchemaMigrationStage;
148 $user = $this->getUser();
149 /* Get the parameters of the request. */
150 $params = $this->extractRequestParams();
152 /* Build our basic query. Namely, something along the lines of:
153 * SELECT * FROM recentchanges WHERE rc_timestamp > $start
154 * AND rc_timestamp < $end AND rc_namespace = $namespace
156 $this->addTables( 'recentchanges' );
157 $this->addTimestampWhereRange( 'rc_timestamp', $params['dir'], $params['start'], $params['end'] );
159 if ( !is_null( $params['continue'] ) ) {
160 $cont = explode( '|', $params['continue'] );
161 $this->dieContinueUsageIf( count( $cont ) != 2 );
162 $db = $this->getDB();
163 $timestamp = $db->addQuotes( $db->timestamp( $cont[0] ) );
164 $id = intval( $cont[1] );
165 $this->dieContinueUsageIf( $id != $cont[1] );
166 $op = $params['dir'] === 'older' ?
'<' : '>';
168 "rc_timestamp $op $timestamp OR " .
169 "(rc_timestamp = $timestamp AND " .
174 $order = $params['dir'] === 'older' ?
'DESC' : 'ASC';
175 $this->addOption( 'ORDER BY', [
176 "rc_timestamp $order",
180 $this->addWhereFld( 'rc_namespace', $params['namespace'] );
182 if ( !is_null( $params['type'] ) ) {
184 $this->addWhereFld( 'rc_type', RecentChange
::parseToRCType( $params['type'] ) );
185 } catch ( Exception
$e ) {
186 ApiBase
::dieDebug( __METHOD__
, $e->getMessage() );
190 $title = $params['title'];
191 if ( !is_null( $title ) ) {
192 $titleObj = Title
::newFromText( $title );
193 if ( is_null( $titleObj ) ) {
194 $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $title ) ] );
196 $this->addWhereFld( 'rc_namespace', $titleObj->getNamespace() );
197 $this->addWhereFld( 'rc_title', $titleObj->getDBkey() );
200 if ( !is_null( $params['show'] ) ) {
201 $show = array_flip( $params['show'] );
203 /* Check for conflicting parameters. */
204 if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
205 ||
( isset( $show['bot'] ) && isset( $show['!bot'] ) )
206 ||
( isset( $show['anon'] ) && isset( $show['!anon'] ) )
207 ||
( isset( $show['redirect'] ) && isset( $show['!redirect'] ) )
208 ||
( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
209 ||
( isset( $show['patrolled'] ) && isset( $show['unpatrolled'] ) )
210 ||
( isset( $show['!patrolled'] ) && isset( $show['unpatrolled'] ) )
211 ||
( isset( $show['autopatrolled'] ) && isset( $show['!autopatrolled'] ) )
212 ||
( isset( $show['autopatrolled'] ) && isset( $show['unpatrolled'] ) )
213 ||
( isset( $show['autopatrolled'] ) && isset( $show['!patrolled'] ) )
215 $this->dieWithError( 'apierror-show' );
219 if ( isset( $show['patrolled'] )
220 ||
isset( $show['!patrolled'] )
221 ||
isset( $show['unpatrolled'] )
222 ||
isset( $show['autopatrolled'] )
223 ||
isset( $show['!autopatrolled'] )
225 if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
226 $this->dieWithError( 'apierror-permissiondenied-patrolflag', 'permissiondenied' );
230 /* Add additional conditions to query depending upon parameters. */
231 $this->addWhereIf( 'rc_minor = 0', isset( $show['!minor'] ) );
232 $this->addWhereIf( 'rc_minor != 0', isset( $show['minor'] ) );
233 $this->addWhereIf( 'rc_bot = 0', isset( $show['!bot'] ) );
234 $this->addWhereIf( 'rc_bot != 0', isset( $show['bot'] ) );
235 if ( isset( $show['anon'] ) ||
isset( $show['!anon'] ) ) {
236 $actorMigration = ActorMigration
::newMigration();
237 $actorQuery = $actorMigration->getJoin( 'rc_user' );
238 $this->addTables( $actorQuery['tables'] );
239 $this->addJoinConds( $actorQuery['joins'] );
241 $actorMigration->isAnon( $actorQuery['fields']['rc_user'] ), isset( $show['anon'] )
244 $actorMigration->isNotAnon( $actorQuery['fields']['rc_user'] ), isset( $show['!anon'] )
247 $this->addWhereIf( 'rc_patrolled = 0', isset( $show['!patrolled'] ) );
248 $this->addWhereIf( 'rc_patrolled != 0', isset( $show['patrolled'] ) );
249 $this->addWhereIf( 'page_is_redirect = 1', isset( $show['redirect'] ) );
251 if ( isset( $show['unpatrolled'] ) ) {
252 // See ChangesList::isUnpatrolled
253 if ( $user->useRCPatrol() ) {
254 $this->addWhere( 'rc_patrolled = ' . RecentChange
::PRC_UNPATROLLED
);
255 } elseif ( $user->useNPPatrol() ) {
256 $this->addWhere( 'rc_patrolled = ' . RecentChange
::PRC_UNPATROLLED
);
257 $this->addWhereFld( 'rc_type', RC_NEW
);
262 'rc_patrolled != ' . RecentChange
::PRC_AUTOPATROLLED
,
263 isset( $show['!autopatrolled'] )
266 'rc_patrolled = ' . RecentChange
::PRC_AUTOPATROLLED
,
267 isset( $show['autopatrolled'] )
270 // Don't throw log entries out the window here
272 'page_is_redirect = 0 OR page_is_redirect IS NULL',
273 isset( $show['!redirect'] )
277 $this->requireMaxOneParameter( $params, 'user', 'excludeuser' );
279 if ( !is_null( $params['user'] ) ) {
280 // Don't query by user ID here, it might be able to use the rc_user_text index.
281 $actorQuery = ActorMigration
::newMigration()
282 ->getWhere( $this->getDB(), 'rc_user', User
::newFromName( $params['user'], false ), false );
283 $this->addTables( $actorQuery['tables'] );
284 $this->addJoinConds( $actorQuery['joins'] );
285 $this->addWhere( $actorQuery['conds'] );
288 if ( !is_null( $params['excludeuser'] ) ) {
289 // Here there's no chance to use the rc_user_text index, so allow ID to be used.
290 $actorQuery = ActorMigration
::newMigration()
291 ->getWhere( $this->getDB(), 'rc_user', User
::newFromName( $params['excludeuser'], false ) );
292 $this->addTables( $actorQuery['tables'] );
293 $this->addJoinConds( $actorQuery['joins'] );
294 $this->addWhere( 'NOT(' . $actorQuery['conds'] . ')' );
297 /* Add the fields we're concerned with to our query. */
308 $showRedirects = false;
309 /* Determine what properties we need to display. */
310 if ( !is_null( $params['prop'] ) ) {
311 $prop = array_flip( $params['prop'] );
313 /* Set up internal members based upon params. */
314 $this->initProperties( $prop );
316 if ( $this->fld_patrolled
&& !$user->useRCPatrol() && !$user->useNPPatrol() ) {
317 $this->dieWithError( 'apierror-permissiondenied-patrolflag', 'permissiondenied' );
320 /* Add fields to our query if they are specified as a needed parameter. */
321 $this->addFieldsIf( [ 'rc_this_oldid', 'rc_last_oldid' ], $this->fld_ids
);
322 if ( $this->fld_user ||
$this->fld_userid
) {
323 $actorQuery = ActorMigration
::newMigration()->getJoin( 'rc_user' );
324 $this->addTables( $actorQuery['tables'] );
325 $this->addFields( $actorQuery['fields'] );
326 $this->addJoinConds( $actorQuery['joins'] );
328 $this->addFieldsIf( [ 'rc_minor', 'rc_type', 'rc_bot' ], $this->fld_flags
);
329 $this->addFieldsIf( [ 'rc_old_len', 'rc_new_len' ], $this->fld_sizes
);
330 $this->addFieldsIf( [ 'rc_patrolled', 'rc_log_type' ], $this->fld_patrolled
);
332 [ 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ],
335 $showRedirects = $this->fld_redirect ||
isset( $show['redirect'] )
336 ||
isset( $show['!redirect'] );
338 $this->addFieldsIf( [ 'rc_this_oldid' ],
339 $resultPageSet && $params['generaterevisions'] );
341 if ( $this->fld_tags
) {
342 $this->addFields( [ 'ts_tags' => ChangeTags
::makeTagSummarySubquery( 'recentchanges' ) ] );
345 if ( $this->fld_sha1
) {
346 $this->addTables( 'revision' );
347 $this->addJoinConds( [ 'revision' => [ 'LEFT JOIN',
348 [ 'rc_this_oldid=rev_id' ] ] ] );
349 $this->addFields( [ 'rev_sha1', 'rev_deleted' ] );
352 if ( $params['toponly'] ||
$showRedirects ) {
353 $this->addTables( 'page' );
354 $this->addJoinConds( [ 'page' => [ 'LEFT JOIN',
355 [ 'rc_namespace=page_namespace', 'rc_title=page_title' ] ] ] );
356 $this->addFields( 'page_is_redirect' );
358 if ( $params['toponly'] ) {
359 $this->addWhere( 'rc_this_oldid = page_latest' );
363 if ( !is_null( $params['tag'] ) ) {
364 $this->addTables( 'change_tag' );
365 $this->addJoinConds( [ 'change_tag' => [ 'INNER JOIN', [ 'rc_id=ct_rc_id' ] ] ] );
366 if ( $wgChangeTagsSchemaMigrationStage > MIGRATION_WRITE_BOTH
) {
367 $changeTagDefStore = MediaWikiServices
::getInstance()->getChangeTagDefStore();
369 $this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $params['tag'] ) );
370 } catch ( NameTableAccessException
$exception ) {
372 $this->addWhere( '1=0' );
375 $this->addWhereFld( 'ct_tag', $params['tag'] );
379 // Paranoia: avoid brute force searches (T19342)
380 if ( !is_null( $params['user'] ) ||
!is_null( $params['excludeuser'] ) ) {
381 if ( !$user->isAllowed( 'deletedhistory' ) ) {
382 $bitmask = RevisionRecord
::DELETED_USER
;
383 } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
384 $bitmask = RevisionRecord
::DELETED_USER | RevisionRecord
::DELETED_RESTRICTED
;
389 $this->addWhere( $this->getDB()->bitAnd( 'rc_deleted', $bitmask ) . " != $bitmask" );
392 if ( $this->getRequest()->getCheck( 'namespace' ) ) {
393 // LogPage::DELETED_ACTION hides the affected page, too.
394 if ( !$user->isAllowed( 'deletedhistory' ) ) {
395 $bitmask = LogPage
::DELETED_ACTION
;
396 } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
397 $bitmask = LogPage
::DELETED_ACTION | LogPage
::DELETED_RESTRICTED
;
402 $this->addWhere( $this->getDB()->makeList( [
403 'rc_type != ' . RC_LOG
,
404 $this->getDB()->bitAnd( 'rc_deleted', $bitmask ) . " != $bitmask",
409 $this->token
= $params['token'];
411 if ( $this->fld_comment ||
$this->fld_parsedcomment ||
$this->token
) {
412 $this->commentStore
= CommentStore
::getStore();
413 $commentQuery = $this->commentStore
->getJoin( 'rc_comment' );
414 $this->addTables( $commentQuery['tables'] );
415 $this->addFields( $commentQuery['fields'] );
416 $this->addJoinConds( $commentQuery['joins'] );
419 $this->addOption( 'LIMIT', $params['limit'] +
1 );
423 /* Perform the actual query. */
424 $res = $this->select( __METHOD__
, [], $hookData );
429 $result = $this->getResult();
431 /* Iterate through the rows, adding data extracted from them to our query result. */
432 foreach ( $res as $row ) {
433 if ( $count === 0 && $resultPageSet !== null ) {
434 // Set the non-continue since the list of recentchanges is
435 // prone to having entries added at the start frequently.
436 $this->getContinuationManager()->addGeneratorNonContinueParam(
437 $this, 'continue', "$row->rc_timestamp|$row->rc_id"
440 if ( ++
$count > $params['limit'] ) {
441 // We've reached the one extra which shows that there are
442 // additional pages to be had. Stop here...
443 $this->setContinueEnumParameter( 'continue', "$row->rc_timestamp|$row->rc_id" );
447 if ( is_null( $resultPageSet ) ) {
448 /* Extract the data from a single row. */
449 $vals = $this->extractRowInfo( $row );
451 /* Add that row's data to our final output. */
452 $fit = $this->processRow( $row, $vals, $hookData ) &&
453 $result->addValue( [ 'query', $this->getModuleName() ], null, $vals );
455 $this->setContinueEnumParameter( 'continue', "$row->rc_timestamp|$row->rc_id" );
458 } elseif ( $params['generaterevisions'] ) {
459 $revid = (int)$row->rc_this_oldid
;
464 $titles[] = Title
::makeTitle( $row->rc_namespace
, $row->rc_title
);
468 if ( is_null( $resultPageSet ) ) {
469 /* Format the result */
470 $result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'rc' );
471 } elseif ( $params['generaterevisions'] ) {
472 $resultPageSet->populateFromRevisionIDs( $revids );
474 $resultPageSet->populateFromTitles( $titles );
479 * Extracts from a single sql row the data needed to describe one recent change.
481 * @param stdClass $row The row from which to extract the data.
482 * @return array An array mapping strings (descriptors) to their respective string values.
485 public function extractRowInfo( $row ) {
486 /* Determine the title of the page that has been changed. */
487 $title = Title
::makeTitle( $row->rc_namespace
, $row->rc_title
);
488 $user = $this->getUser();
490 /* Our output data. */
493 $type = intval( $row->rc_type
);
494 $vals['type'] = RecentChange
::parseFromRCType( $type );
498 /* Create a new entry in the result for the title. */
499 if ( $this->fld_title ||
$this->fld_ids
) {
500 if ( $type === RC_LOG
&& ( $row->rc_deleted
& LogPage
::DELETED_ACTION
) ) {
501 $vals['actionhidden'] = true;
504 if ( $type !== RC_LOG ||
505 LogEventsList
::userCanBitfield( $row->rc_deleted
, LogPage
::DELETED_ACTION
, $user )
507 if ( $this->fld_title
) {
508 ApiQueryBase
::addTitleInfo( $vals, $title );
510 if ( $this->fld_ids
) {
511 $vals['pageid'] = intval( $row->rc_cur_id
);
512 $vals['revid'] = intval( $row->rc_this_oldid
);
513 $vals['old_revid'] = intval( $row->rc_last_oldid
);
518 if ( $this->fld_ids
) {
519 $vals['rcid'] = intval( $row->rc_id
);
522 /* Add user data and 'anon' flag, if user is anonymous. */
523 if ( $this->fld_user ||
$this->fld_userid
) {
524 if ( $row->rc_deleted
& RevisionRecord
::DELETED_USER
) {
525 $vals['userhidden'] = true;
528 if ( RevisionRecord
::userCanBitfield( $row->rc_deleted
, RevisionRecord
::DELETED_USER
, $user ) ) {
529 if ( $this->fld_user
) {
530 $vals['user'] = $row->rc_user_text
;
533 if ( $this->fld_userid
) {
534 $vals['userid'] = (int)$row->rc_user
;
537 if ( !$row->rc_user
) {
538 $vals['anon'] = true;
543 /* Add flags, such as new, minor, bot. */
544 if ( $this->fld_flags
) {
545 $vals['bot'] = (bool)$row->rc_bot
;
546 $vals['new'] = $row->rc_type
== RC_NEW
;
547 $vals['minor'] = (bool)$row->rc_minor
;
550 /* Add sizes of each revision. (Only available on 1.10+) */
551 if ( $this->fld_sizes
) {
552 $vals['oldlen'] = intval( $row->rc_old_len
);
553 $vals['newlen'] = intval( $row->rc_new_len
);
556 /* Add the timestamp. */
557 if ( $this->fld_timestamp
) {
558 $vals['timestamp'] = wfTimestamp( TS_ISO_8601
, $row->rc_timestamp
);
561 /* Add edit summary / log summary. */
562 if ( $this->fld_comment ||
$this->fld_parsedcomment
) {
563 if ( $row->rc_deleted
& RevisionRecord
::DELETED_COMMENT
) {
564 $vals['commenthidden'] = true;
567 if ( RevisionRecord
::userCanBitfield(
568 $row->rc_deleted
, RevisionRecord
::DELETED_COMMENT
, $user
570 $comment = $this->commentStore
->getComment( 'rc_comment', $row )->text
;
571 if ( $this->fld_comment
) {
572 $vals['comment'] = $comment;
575 if ( $this->fld_parsedcomment
) {
576 $vals['parsedcomment'] = Linker
::formatComment( $comment, $title );
581 if ( $this->fld_redirect
) {
582 $vals['redirect'] = (bool)$row->page_is_redirect
;
585 /* Add the patrolled flag */
586 if ( $this->fld_patrolled
) {
587 $vals['patrolled'] = $row->rc_patrolled
!= RecentChange
::PRC_UNPATROLLED
;
588 $vals['unpatrolled'] = ChangesList
::isUnpatrolled( $row, $user );
589 $vals['autopatrolled'] = $row->rc_patrolled
== RecentChange
::PRC_AUTOPATROLLED
;
592 if ( $this->fld_loginfo
&& $row->rc_type
== RC_LOG
) {
593 if ( $row->rc_deleted
& LogPage
::DELETED_ACTION
) {
594 $vals['actionhidden'] = true;
597 if ( LogEventsList
::userCanBitfield( $row->rc_deleted
, LogPage
::DELETED_ACTION
, $user ) ) {
598 $vals['logid'] = intval( $row->rc_logid
);
599 $vals['logtype'] = $row->rc_log_type
;
600 $vals['logaction'] = $row->rc_log_action
;
601 $vals['logparams'] = LogFormatter
::newFromRow( $row )->formatParametersForApi();
605 if ( $this->fld_tags
) {
606 if ( $row->ts_tags
) {
607 $tags = explode( ',', $row->ts_tags
);
608 ApiResult
::setIndexedTagName( $tags, 'tag' );
609 $vals['tags'] = $tags;
615 if ( $this->fld_sha1
&& $row->rev_sha1
!== null ) {
616 if ( $row->rev_deleted
& RevisionRecord
::DELETED_TEXT
) {
617 $vals['sha1hidden'] = true;
620 if ( RevisionRecord
::userCanBitfield(
621 $row->rev_deleted
, RevisionRecord
::DELETED_TEXT
, $user
623 if ( $row->rev_sha1
!== '' ) {
624 $vals['sha1'] = Wikimedia\base_convert
( $row->rev_sha1
, 36, 16, 40 );
631 if ( !is_null( $this->token
) ) {
632 $tokenFunctions = $this->getTokenFunctions();
633 foreach ( $this->token
as $t ) {
634 $val = call_user_func( $tokenFunctions[$t], $row->rc_cur_id
,
635 $title, RecentChange
::newFromRow( $row ) );
636 if ( $val === false ) {
637 $this->addWarning( [ 'apiwarn-tokennotallowed', $t ] );
639 $vals[$t . 'token'] = $val;
644 if ( $anyHidden && ( $row->rc_deleted
& RevisionRecord
::DELETED_RESTRICTED
) ) {
645 $vals['suppressed'] = true;
651 public function getCacheMode( $params ) {
652 if ( isset( $params['show'] ) ) {
653 foreach ( $params['show'] as $show ) {
654 if ( $show === 'patrolled' ||
$show === '!patrolled' ) {
659 if ( isset( $params['token'] ) ) {
662 if ( $this->userCanSeeRevDel() ) {
665 if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) {
666 // formatComment() calls wfMessage() among other things
667 return 'anon-public-user-private';
673 public function getAllowedParams() {
676 ApiBase
::PARAM_TYPE
=> 'timestamp'
679 ApiBase
::PARAM_TYPE
=> 'timestamp'
682 ApiBase
::PARAM_DFLT
=> 'older',
683 ApiBase
::PARAM_TYPE
=> [
687 ApiBase
::PARAM_HELP_MSG
=> 'api-help-param-direction',
690 ApiBase
::PARAM_ISMULTI
=> true,
691 ApiBase
::PARAM_TYPE
=> 'namespace',
692 ApiBase
::PARAM_EXTRA_NAMESPACES
=> [ NS_MEDIA
, NS_SPECIAL
],
695 ApiBase
::PARAM_TYPE
=> 'user'
698 ApiBase
::PARAM_TYPE
=> 'user'
702 ApiBase
::PARAM_ISMULTI
=> true,
703 ApiBase
::PARAM_DFLT
=> 'title|timestamp|ids',
704 ApiBase
::PARAM_TYPE
=> [
720 ApiBase
::PARAM_HELP_MSG_PER_VALUE
=> [],
723 ApiBase
::PARAM_DEPRECATED
=> true,
724 ApiBase
::PARAM_TYPE
=> array_keys( $this->getTokenFunctions() ),
725 ApiBase
::PARAM_ISMULTI
=> true
728 ApiBase
::PARAM_ISMULTI
=> true,
729 ApiBase
::PARAM_TYPE
=> [
746 ApiBase
::PARAM_DFLT
=> 10,
747 ApiBase
::PARAM_TYPE
=> 'limit',
748 ApiBase
::PARAM_MIN
=> 1,
749 ApiBase
::PARAM_MAX
=> ApiBase
::LIMIT_BIG1
,
750 ApiBase
::PARAM_MAX2
=> ApiBase
::LIMIT_BIG2
753 ApiBase
::PARAM_DFLT
=> 'edit|new|log|categorize',
754 ApiBase
::PARAM_ISMULTI
=> true,
755 ApiBase
::PARAM_TYPE
=> RecentChange
::getChangeTypes()
760 ApiBase
::PARAM_HELP_MSG
=> 'api-help-param-continue',
762 'generaterevisions' => false,
766 protected function getExamplesMessages() {
768 'action=query&list=recentchanges'
769 => 'apihelp-query+recentchanges-example-simple',
770 'action=query&generator=recentchanges&grcshow=!patrolled&prop=info'
771 => 'apihelp-query+recentchanges-example-generator',
775 public function getHelpUrls() {
776 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Recentchanges';