MediaWiki master
ApiQueryWatchlist.php
Go to the documentation of this file.
1<?php
23namespace MediaWiki\Api;
24
44
52
53 private CommentStore $commentStore;
54 private WatchedItemQueryService $watchedItemQueryService;
55 private Language $contentLanguage;
56 private NamespaceInfo $namespaceInfo;
57 private GenderCache $genderCache;
58 private CommentFormatter $commentFormatter;
59 private TempUserConfig $tempUserConfig;
60 private LogFormatterFactory $logFormatterFactory;
61
62 public function __construct(
63 ApiQuery $query,
64 string $moduleName,
65 CommentStore $commentStore,
66 WatchedItemQueryService $watchedItemQueryService,
67 Language $contentLanguage,
68 NamespaceInfo $namespaceInfo,
69 GenderCache $genderCache,
70 CommentFormatter $commentFormatter,
71 TempUserConfig $tempUserConfig,
72 LogFormatterFactory $logFormatterFactory
73 ) {
74 parent::__construct( $query, $moduleName, 'wl' );
75 $this->commentStore = $commentStore;
76 $this->watchedItemQueryService = $watchedItemQueryService;
77 $this->contentLanguage = $contentLanguage;
78 $this->namespaceInfo = $namespaceInfo;
79 $this->genderCache = $genderCache;
80 $this->commentFormatter = $commentFormatter;
81 $this->tempUserConfig = $tempUserConfig;
82 $this->logFormatterFactory = $logFormatterFactory;
83 }
84
85 public function execute() {
86 $this->run();
87 }
88
89 public function executeGenerator( $resultPageSet ) {
90 $this->run( $resultPageSet );
91 }
92
93 private bool $fld_ids = false;
94 private bool $fld_title = false;
95 private bool $fld_patrol = false;
96 private bool $fld_flags = false;
97 private bool $fld_timestamp = false;
98 private bool $fld_user = false;
99 private bool $fld_comment = false;
100 private bool $fld_parsedcomment = false;
101 private bool $fld_sizes = false;
102 private bool $fld_notificationtimestamp = false;
103 private bool $fld_userid = false;
104 private bool $fld_loginfo = false;
105 private bool $fld_tags = false;
106 private bool $fld_expiry = false;
107
112 private function run( $resultPageSet = null ) {
113 $params = $this->extractRequestParams();
114
115 $user = $this->getUser();
116 $wlowner = $this->getWatchlistUser( $params );
117
118 if ( $params['prop'] !== null && $resultPageSet === null ) {
119 $prop = array_fill_keys( $params['prop'], true );
120
121 $this->fld_ids = isset( $prop['ids'] );
122 $this->fld_title = isset( $prop['title'] );
123 $this->fld_flags = isset( $prop['flags'] );
124 $this->fld_user = isset( $prop['user'] );
125 $this->fld_userid = isset( $prop['userid'] );
126 $this->fld_comment = isset( $prop['comment'] );
127 $this->fld_parsedcomment = isset( $prop['parsedcomment'] );
128 $this->fld_timestamp = isset( $prop['timestamp'] );
129 $this->fld_sizes = isset( $prop['sizes'] );
130 $this->fld_patrol = isset( $prop['patrol'] );
131 $this->fld_notificationtimestamp = isset( $prop['notificationtimestamp'] );
132 $this->fld_loginfo = isset( $prop['loginfo'] );
133 $this->fld_tags = isset( $prop['tags'] );
134 $this->fld_expiry = isset( $prop['expiry'] );
135
136 if ( $this->fld_patrol && !$user->useRCPatrol() && !$user->useNPPatrol() ) {
137 $this->dieWithError( 'apierror-permissiondenied-patrolflag', 'patrol' );
138 }
139 }
140
141 $options = [
142 'dir' => $params['dir'] === 'older'
143 ? WatchedItemQueryService::DIR_OLDER
144 : WatchedItemQueryService::DIR_NEWER,
145 ];
146
147 if ( $resultPageSet === null ) {
148 $options['includeFields'] = $this->getFieldsToInclude();
149 } else {
150 $options['usedInGenerator'] = true;
151 }
152
153 if ( $params['start'] ) {
154 $options['start'] = $params['start'];
155 }
156 if ( $params['end'] ) {
157 $options['end'] = $params['end'];
158 }
159
160 $startFrom = null;
161 if ( $params['continue'] !== null ) {
162 $cont = $this->parseContinueParamOrDie( $params['continue'], [ 'string', 'int' ] );
163 $startFrom = $cont;
164 }
165
166 if ( $wlowner !== $user ) {
167 $options['watchlistOwner'] = $wlowner;
168 $options['watchlistOwnerToken'] = $params['token'];
169 }
170
171 if ( $params['namespace'] !== null ) {
172 $options['namespaceIds'] = $params['namespace'];
173 }
174
175 if ( $params['allrev'] ) {
176 $options['allRevisions'] = true;
177 }
178
179 if ( $params['show'] !== null ) {
180 $show = array_fill_keys( $params['show'], true );
181
182 /* Check for conflicting parameters. */
183 if ( $this->showParamsConflicting( $show ) ) {
184 $this->dieWithError( 'apierror-show' );
185 }
186
187 // Check permissions.
188 if ( isset( $show[WatchedItemQueryService::FILTER_PATROLLED] )
189 || isset( $show[WatchedItemQueryService::FILTER_NOT_PATROLLED] )
190 ) {
191 if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
192 $this->dieWithError( 'apierror-permissiondenied-patrolflag', 'permissiondenied' );
193 }
194 }
195
196 $options['filters'] = array_keys( $show );
197 }
198
199 if ( $params['type'] !== null ) {
200 $rcTypes = RecentChange::parseToRCType( $params['type'] );
201 if ( $rcTypes ) {
202 $options['rcTypes'] = $rcTypes;
203 }
204 }
205
206 $this->requireMaxOneParameter( $params, 'user', 'excludeuser' );
207 if ( $params['user'] !== null ) {
208 $options['onlyByUser'] = $params['user'];
209 }
210 if ( $params['excludeuser'] !== null ) {
211 $options['notByUser'] = $params['excludeuser'];
212 }
213
214 $options['limit'] = $params['limit'];
215
216 $this->getHookRunner()->onApiQueryWatchlistPrepareWatchedItemQueryServiceOptions(
217 $this, $params, $options );
218
219 $ids = [];
220 $items = $this->watchedItemQueryService->getWatchedItemsWithRecentChangeInfo( $wlowner, $options, $startFrom );
221
222 // Get gender information
223 if ( $items !== [] && $resultPageSet === null && $this->fld_title &&
224 $this->contentLanguage->needsGenderDistinction()
225 ) {
226 $usernames = [];
227 foreach ( $items as [ $watchedItem, ] ) {
229 $linkTarget = $watchedItem->getTarget();
230 if ( $this->namespaceInfo->hasGenderDistinction( $linkTarget->getNamespace() ) ) {
231 $usernames[] = $linkTarget->getText();
232 }
233 }
234 if ( $usernames !== [] ) {
235 $this->genderCache->doQuery( $usernames, __METHOD__ );
236 }
237 }
238
239 foreach ( $items as [ $watchedItem, $recentChangeInfo ] ) {
241 if ( $resultPageSet === null ) {
242 $vals = $this->extractOutputData( $watchedItem, $recentChangeInfo );
243 $fit = $this->getResult()->addValue( [ 'query', $this->getModuleName() ], null, $vals );
244 if ( !$fit ) {
245 $startFrom = [ $recentChangeInfo['rc_timestamp'], $recentChangeInfo['rc_id'] ];
246 break;
247 }
248 } elseif ( $params['allrev'] ) {
249 $ids[] = (int)$recentChangeInfo['rc_this_oldid'];
250 } else {
251 $ids[] = (int)$recentChangeInfo['rc_cur_id'];
252 }
253 }
254
255 if ( $startFrom !== null ) {
256 $this->setContinueEnumParameter( 'continue', implode( '|', $startFrom ) );
257 }
258
259 if ( $resultPageSet === null ) {
260 $this->getResult()->addIndexedTagName(
261 [ 'query', $this->getModuleName() ],
262 'item'
263 );
264 } elseif ( $params['allrev'] ) {
265 $resultPageSet->populateFromRevisionIDs( $ids );
266 } else {
267 $resultPageSet->populateFromPageIDs( $ids );
268 }
269 }
270
271 private function getFieldsToInclude() {
272 $includeFields = [];
273 if ( $this->fld_flags ) {
274 $includeFields[] = WatchedItemQueryService::INCLUDE_FLAGS;
275 }
276 if ( $this->fld_user || $this->fld_userid || $this->fld_loginfo ) {
277 $includeFields[] = WatchedItemQueryService::INCLUDE_USER_ID;
278 }
279 if ( $this->fld_user || $this->fld_loginfo ) {
280 $includeFields[] = WatchedItemQueryService::INCLUDE_USER;
281 }
282 if ( $this->fld_comment || $this->fld_parsedcomment ) {
283 $includeFields[] = WatchedItemQueryService::INCLUDE_COMMENT;
284 }
285 if ( $this->fld_patrol ) {
286 $includeFields[] = WatchedItemQueryService::INCLUDE_PATROL_INFO;
287 $includeFields[] = WatchedItemQueryService::INCLUDE_AUTOPATROL_INFO;
288 }
289 if ( $this->fld_sizes ) {
290 $includeFields[] = WatchedItemQueryService::INCLUDE_SIZES;
291 }
292 if ( $this->fld_loginfo ) {
293 $includeFields[] = WatchedItemQueryService::INCLUDE_LOG_INFO;
294 }
295 if ( $this->fld_tags ) {
296 $includeFields[] = WatchedItemQueryService::INCLUDE_TAGS;
297 }
298 return $includeFields;
299 }
300
301 private function showParamsConflicting( array $show ) {
302 return ( isset( $show[WatchedItemQueryService::FILTER_MINOR] )
303 && isset( $show[WatchedItemQueryService::FILTER_NOT_MINOR] ) )
304 || ( isset( $show[WatchedItemQueryService::FILTER_BOT] )
305 && isset( $show[WatchedItemQueryService::FILTER_NOT_BOT] ) )
306 || ( isset( $show[WatchedItemQueryService::FILTER_ANON] )
307 && isset( $show[WatchedItemQueryService::FILTER_NOT_ANON] ) )
308 || ( isset( $show[WatchedItemQueryService::FILTER_PATROLLED] )
309 && isset( $show[WatchedItemQueryService::FILTER_NOT_PATROLLED] ) )
310 || ( isset( $show[WatchedItemQueryService::FILTER_AUTOPATROLLED] )
311 && isset( $show[WatchedItemQueryService::FILTER_NOT_AUTOPATROLLED] ) )
312 || ( isset( $show[WatchedItemQueryService::FILTER_AUTOPATROLLED] )
313 && isset( $show[WatchedItemQueryService::FILTER_NOT_PATROLLED] ) )
314 || ( isset( $show[WatchedItemQueryService::FILTER_UNREAD] )
315 && isset( $show[WatchedItemQueryService::FILTER_NOT_UNREAD] ) );
316 }
317
318 private function extractOutputData( WatchedItem $watchedItem, array $recentChangeInfo ) {
319 /* Determine the title of the page that has been changed. */
320 $target = $watchedItem->getTarget();
321 if ( $target instanceof LinkTarget ) {
322 $title = Title::newFromLinkTarget( $target );
323 } else {
324 $title = Title::newFromPageIdentity( $target );
325 }
326 $user = $this->getUser();
327
328 /* Our output data. */
329 $vals = [];
330 $type = (int)$recentChangeInfo['rc_type'];
331 $vals['type'] = RecentChange::parseFromRCType( $type );
332 $anyHidden = false;
333
334 /* Create a new entry in the result for the title. */
335 if ( $this->fld_title || $this->fld_ids ) {
336 // These should already have been filtered out of the query, but just in case.
337 if ( $type === RC_LOG && ( $recentChangeInfo['rc_deleted'] & LogPage::DELETED_ACTION ) ) {
338 $vals['actionhidden'] = true;
339 $anyHidden = true;
340 }
341 if ( $type !== RC_LOG ||
342 LogEventsList::userCanBitfield(
343 $recentChangeInfo['rc_deleted'],
344 LogPage::DELETED_ACTION,
345 $user
346 )
347 ) {
348 if ( $this->fld_title ) {
349 ApiQueryBase::addTitleInfo( $vals, $title );
350 }
351 if ( $this->fld_ids ) {
352 $vals['pageid'] = (int)$recentChangeInfo['rc_cur_id'];
353 $vals['revid'] = (int)$recentChangeInfo['rc_this_oldid'];
354 $vals['old_revid'] = (int)$recentChangeInfo['rc_last_oldid'];
355 }
356 }
357 }
358
359 if ( $this->fld_user || $this->fld_userid ) {
360 if ( $recentChangeInfo['rc_deleted'] & RevisionRecord::DELETED_USER ) {
361 $vals['userhidden'] = true;
362 $anyHidden = true;
363 }
364 if ( RevisionRecord::userCanBitfield(
365 $recentChangeInfo['rc_deleted'],
366 RevisionRecord::DELETED_USER,
367 $user
368 ) ) {
369 if ( $this->fld_userid ) {
370 $vals['userid'] = (int)$recentChangeInfo['rc_user'];
371 // for backwards compatibility
372 $vals['user'] = (int)$recentChangeInfo['rc_user'];
373 }
374
375 if ( $this->fld_user ) {
376 $vals['user'] = $recentChangeInfo['rc_user_text'];
377 $vals['temp'] = $this->tempUserConfig->isTempName(
378 $recentChangeInfo['rc_user_text']
379 );
380 }
381
382 // Whether the user is a logged-out user (IP user). This does
383 // not include temporary users, though they are grouped with IP
384 // users for FILTER_NOT_ANON and FILTER_ANON, to match the
385 // recent changes filters (T343322).
386 $vals['anon'] = !$recentChangeInfo['rc_user'];
387
388 }
389 }
390
391 /* Add flags, such as new, minor, bot. */
392 if ( $this->fld_flags ) {
393 $vals['bot'] = (bool)$recentChangeInfo['rc_bot'];
394 $vals['new'] = $recentChangeInfo['rc_type'] == RC_NEW;
395 $vals['minor'] = (bool)$recentChangeInfo['rc_minor'];
396 }
397
398 /* Add sizes of each revision. (Only available on 1.10+) */
399 if ( $this->fld_sizes ) {
400 $vals['oldlen'] = (int)$recentChangeInfo['rc_old_len'];
401 $vals['newlen'] = (int)$recentChangeInfo['rc_new_len'];
402 }
403
404 /* Add the timestamp. */
405 if ( $this->fld_timestamp ) {
406 $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $recentChangeInfo['rc_timestamp'] );
407 }
408
409 if ( $this->fld_notificationtimestamp ) {
410 $vals['notificationtimestamp'] = ( $watchedItem->getNotificationTimestamp() == null )
411 ? ''
412 : wfTimestamp( TS_ISO_8601, $watchedItem->getNotificationTimestamp() );
413 }
414
415 /* Add edit summary / log summary. */
416 if ( $this->fld_comment || $this->fld_parsedcomment ) {
417 if ( $recentChangeInfo['rc_deleted'] & RevisionRecord::DELETED_COMMENT ) {
418 $vals['commenthidden'] = true;
419 $anyHidden = true;
420 }
421 if ( RevisionRecord::userCanBitfield(
422 $recentChangeInfo['rc_deleted'],
423 RevisionRecord::DELETED_COMMENT,
424 $user
425 ) ) {
426 $comment = $this->commentStore->getComment( 'rc_comment', $recentChangeInfo )->text;
427 if ( $this->fld_comment ) {
428 $vals['comment'] = $comment;
429 }
430
431 if ( $this->fld_parsedcomment ) {
432 $vals['parsedcomment'] = $this->commentFormatter->format( $comment, $title );
433 }
434 }
435 }
436
437 /* Add the patrolled flag */
438 if ( $this->fld_patrol ) {
439 $vals['patrolled'] = $recentChangeInfo['rc_patrolled'] != RecentChange::PRC_UNPATROLLED;
440 $vals['unpatrolled'] = ChangesList::isUnpatrolled( (object)$recentChangeInfo, $user );
441 $vals['autopatrolled'] = $recentChangeInfo['rc_patrolled'] == RecentChange::PRC_AUTOPATROLLED;
442 }
443
444 if ( $this->fld_loginfo && $recentChangeInfo['rc_type'] == RC_LOG ) {
445 if ( $recentChangeInfo['rc_deleted'] & LogPage::DELETED_ACTION ) {
446 $vals['actionhidden'] = true;
447 $anyHidden = true;
448 }
449 if ( LogEventsList::userCanBitfield(
450 $recentChangeInfo['rc_deleted'],
451 LogPage::DELETED_ACTION,
452 $user
453 ) ) {
454 $vals['logid'] = (int)$recentChangeInfo['rc_logid'];
455 $vals['logtype'] = $recentChangeInfo['rc_log_type'];
456 $vals['logaction'] = $recentChangeInfo['rc_log_action'];
457
458 $logFormatter = $this->logFormatterFactory->newFromRow( $recentChangeInfo );
459 $vals['logparams'] = $logFormatter->formatParametersForApi();
460 $vals['logdisplay'] = $logFormatter->getActionText();
461 }
462 }
463
464 if ( $this->fld_tags ) {
465 if ( $recentChangeInfo['rc_tags'] ) {
466 $tags = explode( ',', $recentChangeInfo['rc_tags'] );
467 ApiResult::setIndexedTagName( $tags, 'tag' );
468 $vals['tags'] = $tags;
469 } else {
470 $vals['tags'] = [];
471 }
472 }
473
474 if ( $this->fld_expiry ) {
475 // Add expiration, T263796
476 $expiry = $watchedItem->getExpiry( TS_ISO_8601 );
477 $vals['expiry'] = ( $expiry ?? false );
478 }
479
480 if ( $anyHidden && ( $recentChangeInfo['rc_deleted'] & RevisionRecord::DELETED_RESTRICTED ) ) {
481 $vals['suppressed'] = true;
482 }
483
484 $this->getHookRunner()->onApiQueryWatchlistExtractOutputData(
485 $this, $watchedItem, $recentChangeInfo, $vals );
486
487 return $vals;
488 }
489
490 public function getAllowedParams() {
491 return [
492 'allrev' => false,
493 'start' => [
494 ParamValidator::PARAM_TYPE => 'timestamp'
495 ],
496 'end' => [
497 ParamValidator::PARAM_TYPE => 'timestamp'
498 ],
499 'namespace' => [
500 ParamValidator::PARAM_ISMULTI => true,
501 ParamValidator::PARAM_TYPE => 'namespace'
502 ],
503 'user' => [
504 ParamValidator::PARAM_TYPE => 'user',
505 UserDef::PARAM_ALLOWED_USER_TYPES => [ 'name', 'ip', 'temp', 'id', 'interwiki' ],
506 ],
507 'excludeuser' => [
508 ParamValidator::PARAM_TYPE => 'user',
509 UserDef::PARAM_ALLOWED_USER_TYPES => [ 'name', 'ip', 'temp', 'id', 'interwiki' ],
510 ],
511 'dir' => [
512 ParamValidator::PARAM_DEFAULT => 'older',
513 ParamValidator::PARAM_TYPE => [
514 'newer',
515 'older'
516 ],
517 ApiBase::PARAM_HELP_MSG => 'api-help-param-direction',
519 'newer' => 'api-help-paramvalue-direction-newer',
520 'older' => 'api-help-paramvalue-direction-older',
521 ],
522 ],
523 'limit' => [
524 ParamValidator::PARAM_DEFAULT => 10,
525 ParamValidator::PARAM_TYPE => 'limit',
526 IntegerDef::PARAM_MIN => 1,
527 IntegerDef::PARAM_MAX => ApiBase::LIMIT_BIG1,
528 IntegerDef::PARAM_MAX2 => ApiBase::LIMIT_BIG2
529 ],
530 'prop' => [
531 ParamValidator::PARAM_ISMULTI => true,
532 ParamValidator::PARAM_DEFAULT => 'ids|title|flags',
534 ParamValidator::PARAM_TYPE => [
535 'ids',
536 'title',
537 'flags',
538 'user',
539 'userid',
540 'comment',
541 'parsedcomment',
542 'timestamp',
543 'patrol',
544 'sizes',
545 'notificationtimestamp',
546 'loginfo',
547 'tags',
548 'expiry',
549 ]
550 ],
551 'show' => [
552 ParamValidator::PARAM_ISMULTI => true,
553 ParamValidator::PARAM_TYPE => [
554 WatchedItemQueryService::FILTER_MINOR,
555 WatchedItemQueryService::FILTER_NOT_MINOR,
556 WatchedItemQueryService::FILTER_BOT,
557 WatchedItemQueryService::FILTER_NOT_BOT,
558 WatchedItemQueryService::FILTER_ANON,
559 WatchedItemQueryService::FILTER_NOT_ANON,
560 WatchedItemQueryService::FILTER_PATROLLED,
561 WatchedItemQueryService::FILTER_NOT_PATROLLED,
562 WatchedItemQueryService::FILTER_AUTOPATROLLED,
563 WatchedItemQueryService::FILTER_NOT_AUTOPATROLLED,
564 WatchedItemQueryService::FILTER_UNREAD,
565 WatchedItemQueryService::FILTER_NOT_UNREAD,
566 ]
567 ],
568 'type' => [
569 ParamValidator::PARAM_DEFAULT => 'edit|new|log|categorize',
570 ParamValidator::PARAM_ISMULTI => true,
572 ParamValidator::PARAM_TYPE => RecentChange::getChangeTypes()
573 ],
574 'owner' => [
575 ParamValidator::PARAM_TYPE => 'user',
576 UserDef::PARAM_ALLOWED_USER_TYPES => [ 'name' ],
577 ],
578 'token' => [
579 ParamValidator::PARAM_TYPE => 'string',
580 ParamValidator::PARAM_SENSITIVE => true,
581 ],
582 'continue' => [
583 ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
584 ],
585 ];
586 }
587
588 protected function getExamplesMessages() {
589 return [
590 'action=query&list=watchlist'
591 => 'apihelp-query+watchlist-example-simple',
592 'action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment'
593 => 'apihelp-query+watchlist-example-props',
594 'action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment|expiry'
595 => 'apihelp-query+watchlist-example-expiry',
596 'action=query&list=watchlist&wlallrev=&wlprop=ids|title|timestamp|user|comment'
597 => 'apihelp-query+watchlist-example-allrev',
598 'action=query&generator=watchlist&prop=info'
599 => 'apihelp-query+watchlist-example-generator',
600 'action=query&generator=watchlist&gwlallrev=&prop=revisions&rvprop=timestamp|user'
601 => 'apihelp-query+watchlist-example-generator-rev',
602 'action=query&list=watchlist&wlowner=Example&wltoken=123ABC'
603 => 'apihelp-query+watchlist-example-wlowner',
604 ];
605 }
606
607 public function getHelpUrls() {
608 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Watchlist';
609 }
610}
611
613class_alias( ApiQueryWatchlist::class, 'ApiQueryWatchlist' );
const RC_NEW
Definition Defines.php:118
const RC_LOG
Definition Defines.php:119
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
dieWithError( $msg, $code=null, $data=null, $httpCode=0)
Abort execution with an error.
Definition ApiBase.php:1522
getModuleName()
Get the name of the module being executed by this instance.
Definition ApiBase.php:557
getHookRunner()
Get an ApiHookRunner for running core API hooks.
Definition ApiBase.php:781
parseContinueParamOrDie(string $continue, array $types)
Parse the 'continue' parameter in the usual format and validate the types of each part,...
Definition ApiBase.php:1707
getWatchlistUser( $params)
Gets the user for whom to get the watchlist.
Definition ApiBase.php:1306
getResult()
Get the result object.
Definition ApiBase.php:696
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, or 'string' with PARAM_ISMULTI,...
Definition ApiBase.php:221
requireMaxOneParameter( $params,... $required)
Dies if more than one parameter from a certain set of parameters are set and not false.
Definition ApiBase.php:1011
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
Definition ApiBase.php:181
const LIMIT_BIG2
Fast query, apihighlimits limit.
Definition ApiBase.php:248
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition ApiBase.php:837
const LIMIT_BIG1
Fast query, standard limit.
Definition ApiBase.php:246
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
setContinueEnumParameter( $paramName, $paramValue)
Overridden to set the generator param if in generator mode.
This query action allows clients to retrieve a list of recently modified pages that are part of the l...
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
executeGenerator( $resultPageSet)
Execute this module as a generator.
getExamplesMessages()
Returns usage examples for this module.
__construct(ApiQuery $query, string $moduleName, CommentStore $commentStore, WatchedItemQueryService $watchedItemQueryService, Language $contentLanguage, NamespaceInfo $namespaceInfo, GenderCache $genderCache, CommentFormatter $commentFormatter, TempUserConfig $tempUserConfig, LogFormatterFactory $logFormatterFactory)
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getHelpUrls()
Return links to more detailed help pages about the module.
This is the main query class.
Definition ApiQuery.php:48
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Look up "gender" user preference.
This is the main service interface for converting single-line comments from various DB comment fields...
Handle database storage of comments such as edit summaries and log reasons.
Base class for language-specific code.
Definition Language.php:82
Class to simplify the use of log pages.
Definition LogPage.php:50
Type definition for user types.
Definition UserDef.php:27
Base class for lists of recent changes shown on special pages.
Utility class for creating and reading rows in the recentchanges table.
Page revision base class.
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Represents a title within MediaWiki.
Definition Title.php:78
Representation of a pair of user and title for watchlist entries.
Service for formatting and validating API parameters.
Type definition for integer types.
Represents the target of a wiki link.
Interface for temporary user creation config and name matching.
array $params
The job parameters.