Go to the documentation of this file.
41 parent::__construct(
$query, $moduleName,
'wl' );
49 $this->
run( $resultPageSet );
62 private function run( $resultPageSet =
null ) {
70 if ( !is_null(
$params[
'prop'] ) && is_null( $resultPageSet ) ) {
71 $prop = array_flip(
$params[
'prop'] );
73 $this->fld_ids = isset( $prop[
'ids'] );
74 $this->fld_title = isset( $prop[
'title'] );
75 $this->fld_flags = isset( $prop[
'flags'] );
76 $this->fld_user = isset( $prop[
'user'] );
77 $this->fld_userid = isset( $prop[
'userid'] );
78 $this->fld_comment = isset( $prop[
'comment'] );
79 $this->fld_parsedcomment = isset( $prop[
'parsedcomment'] );
80 $this->fld_timestamp = isset( $prop[
'timestamp'] );
81 $this->fld_sizes = isset( $prop[
'sizes'] );
82 $this->fld_patrol = isset( $prop[
'patrol'] );
83 $this->fld_notificationtimestamp = isset( $prop[
'notificationtimestamp'] );
84 $this->fld_loginfo = isset( $prop[
'loginfo'] );
86 if ( $this->fld_patrol ) {
87 if ( !
$user->useRCPatrol() && !
$user->useNPPatrol() ) {
88 $this->
dieWithError(
'apierror-permissiondenied-patrolflag',
'patrol' );
92 if ( $this->fld_comment || $this->fld_parsedcomment ) {
98 'dir' =>
$params[
'dir'] ===
'older'
103 if ( is_null( $resultPageSet ) ) {
117 if ( !is_null(
$params[
'continue'] ) ) {
118 $cont = explode(
'|',
$params[
'continue'] );
120 $continueTimestamp = $cont[0];
121 $continueId = (int)$cont[1];
123 $startFrom = [ $continueTimestamp, $continueId ];
126 if ( $wlowner !==
$user ) {
127 $options[
'watchlistOwner'] = $wlowner;
131 if ( !is_null(
$params[
'namespace'] ) ) {
139 if ( !is_null(
$params[
'show'] ) ) {
140 $show = array_flip(
$params[
'show'] );
151 if ( !
$user->useRCPatrol() && !
$user->useNPPatrol() ) {
152 $this->
dieWithError(
'apierror-permissiondenied-patrolflag',
'permissiondenied' );
156 $options[
'filters'] = array_keys( $show );
159 if ( !is_null(
$params[
'type'] ) ) {
165 }
catch ( Exception
$e ) {
171 if ( !is_null(
$params[
'user'] ) ) {
174 if ( !is_null(
$params[
'excludeuser'] ) ) {
180 Hooks::run(
'ApiQueryWatchlistPrepareWatchedItemQueryServiceOptions', [
186 $watchedItemQuery = MediaWikiServices::getInstance()->getWatchedItemQueryService();
187 $items = $watchedItemQuery->getWatchedItemsWithRecentChangeInfo( $wlowner,
$options, $startFrom );
189 foreach ( $items
as list( $watchedItem, $recentChangeInfo ) ) {
191 if ( is_null( $resultPageSet ) ) {
195 $startFrom = [ $recentChangeInfo[
'rc_timestamp'], $recentChangeInfo[
'rc_id'] ];
200 $ids[] = intval( $recentChangeInfo[
'rc_this_oldid'] );
202 $ids[] = intval( $recentChangeInfo[
'rc_cur_id'] );
207 if ( $startFrom !==
null ) {
211 if ( is_null( $resultPageSet ) ) {
216 } elseif (
$params[
'allrev'] ) {
217 $resultPageSet->populateFromRevisionIDs( $ids );
219 $resultPageSet->populateFromPageIDs( $ids );
225 if ( $this->fld_flags ) {
228 if ( $this->fld_user || $this->fld_userid ) {
231 if ( $this->fld_user ) {
234 if ( $this->fld_comment || $this->fld_parsedcomment ) {
237 if ( $this->fld_patrol ) {
240 if ( $this->fld_sizes ) {
243 if ( $this->fld_loginfo ) {
246 return $includeFields;
269 $type = intval( $recentChangeInfo[
'rc_type'] );
274 if ( $this->fld_title || $this->fld_ids ) {
277 $vals[
'actionhidden'] =
true;
282 $recentChangeInfo[
'rc_deleted'],
287 if ( $this->fld_title ) {
290 if ( $this->fld_ids ) {
291 $vals[
'pageid'] = intval( $recentChangeInfo[
'rc_cur_id'] );
292 $vals[
'revid'] = intval( $recentChangeInfo[
'rc_this_oldid'] );
293 $vals[
'old_revid'] = intval( $recentChangeInfo[
'rc_last_oldid'] );
299 if ( $this->fld_user || $this->fld_userid ) {
301 $vals[
'userhidden'] =
true;
305 $recentChangeInfo[
'rc_deleted'],
309 if ( $this->fld_userid ) {
310 $vals[
'userid'] = (int)$recentChangeInfo[
'rc_user'];
312 $vals[
'user'] = (int)$recentChangeInfo[
'rc_user'];
315 if ( $this->fld_user ) {
316 $vals[
'user'] = $recentChangeInfo[
'rc_user_text'];
319 if ( !$recentChangeInfo[
'rc_user'] ) {
320 $vals[
'anon'] =
true;
326 if ( $this->fld_flags ) {
327 $vals[
'bot'] = (bool)$recentChangeInfo[
'rc_bot'];
328 $vals[
'new'] = $recentChangeInfo[
'rc_type'] ==
RC_NEW;
329 $vals[
'minor'] = (bool)$recentChangeInfo[
'rc_minor'];
333 if ( $this->fld_sizes ) {
334 $vals[
'oldlen'] = intval( $recentChangeInfo[
'rc_old_len'] );
335 $vals[
'newlen'] = intval( $recentChangeInfo[
'rc_new_len'] );
339 if ( $this->fld_timestamp ) {
340 $vals[
'timestamp'] =
wfTimestamp( TS_ISO_8601, $recentChangeInfo[
'rc_timestamp'] );
343 if ( $this->fld_notificationtimestamp ) {
350 if ( $this->fld_comment || $this->fld_parsedcomment ) {
352 $vals[
'commenthidden'] =
true;
356 $recentChangeInfo[
'rc_deleted'],
360 $comment = $this->commentStore->getComment( $recentChangeInfo )->text;
361 if ( $this->fld_comment ) {
362 $vals[
'comment'] = $comment;
365 if ( $this->fld_parsedcomment ) {
372 if ( $this->fld_patrol ) {
373 $vals[
'patrolled'] = $recentChangeInfo[
'rc_patrolled'] == 1;
377 if ( $this->fld_loginfo && $recentChangeInfo[
'rc_type'] ==
RC_LOG ) {
379 $vals[
'actionhidden'] =
true;
383 $recentChangeInfo[
'rc_deleted'],
387 $vals[
'logid'] = intval( $recentChangeInfo[
'rc_logid'] );
388 $vals[
'logtype'] = $recentChangeInfo[
'rc_log_type'];
389 $vals[
'logaction'] = $recentChangeInfo[
'rc_log_action'];
395 $vals[
'suppressed'] =
true;
398 Hooks::run(
'ApiQueryWatchlistExtractOutputData', [
399 $this, $watchedItem, $recentChangeInfo, &$vals
454 'notificationtimestamp',
494 'action=query&list=watchlist'
495 =>
'apihelp-query+watchlist-example-simple',
496 'action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment'
497 =>
'apihelp-query+watchlist-example-props',
498 'action=query&list=watchlist&wlallrev=&wlprop=ids|title|timestamp|user|comment'
499 =>
'apihelp-query+watchlist-example-allrev',
500 'action=query&generator=watchlist&prop=info'
501 =>
'apihelp-query+watchlist-example-generator',
502 'action=query&generator=watchlist&gwlallrev=&prop=revisions&rvprop=timestamp|user'
503 =>
'apihelp-query+watchlist-example-generator-rev',
504 'action=query&list=watchlist&wlowner=Example&wltoken=123ABC'
505 =>
'apihelp-query+watchlist-example-wlowner',
510 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Watchlist';
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
This is the main query class.
static userCanBitfield( $bitfield, $field, User $user=null, Title $title=null)
Determine if the current user is allowed to view a particular field of this revision,...
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
static getChangeTypes()
Get an array of all change types.
$fld_notificationtimestamp
static parseToRCType( $type)
Parsing text to RC_* constants.
getUser()
Get the User object.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
const PARAM_SENSITIVE
(boolean) Is the parameter sensitive? Note 'password'-type fields are always sensitive regardless of ...
setContinueEnumParameter( $paramName, $paramValue)
Overridden to set the generator param if in generator mode.
null for the wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
namespace and then decline to actually register it file or subcat img or subcat $title
static newFromLinkTarget(LinkTarget $linkTarget)
Create a new Title from a LinkTarget.
const LIMIT_BIG1
Fast query, standard limit.
const INCLUDE_PATROL_INFO
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
executeGenerator( $resultPageSet)
Execute this module as a generator.
showParamsConflicting(array $show)
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
CommentStore $commentStore
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getWatchlistUser( $params)
Gets the user for whom to get the watchlist.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
Representation of a pair of user and title for watchlist entries.
const FILTER_NOT_PATROLLED
requireMaxOneParameter( $params, $required)
Die if more than one of a certain set of parameters is set and not false.
extractOutputData(WatchedItem $watchedItem, array $recentChangeInfo)
static formatComment( $comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
getHelpUrls()
Return links to more detailed help pages about the module.
This query action allows clients to retrieve a list of recently modified pages that are part of the l...
selectNamedDB( $name, $db, $groups)
Selects the query database connection with the given name.
const LIMIT_BIG2
Fast query, apihighlimits limit.
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
static parseFromRCType( $rcType)
Parsing RC_* constants to human-readable test.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getModuleName()
Get the name of the module being executed by this instance.
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right,...
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getNotificationTimestamp()
Get the notification timestamp of this entry.
static isUnpatrolled( $rc, User $user)
getExamplesMessages()
Returns usage examples for this module.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
run( $resultPageSet=null)
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
__construct(ApiQuery $query, $moduleName)
the array() calling protocol came about after MediaWiki 1.4rc1.