Go to the documentation of this file.
38 parent::__construct(
$query, $moduleName,
'wl' );
46 $this->
run( $resultPageSet );
59 private function run( $resultPageSet =
null ) {
67 if ( !is_null(
$params[
'prop'] ) && is_null( $resultPageSet ) ) {
68 $prop = array_flip(
$params[
'prop'] );
70 $this->fld_ids = isset( $prop[
'ids'] );
71 $this->fld_title = isset( $prop[
'title'] );
72 $this->fld_flags = isset( $prop[
'flags'] );
73 $this->fld_user = isset( $prop[
'user'] );
74 $this->fld_userid = isset( $prop[
'userid'] );
75 $this->fld_comment = isset( $prop[
'comment'] );
76 $this->fld_parsedcomment = isset( $prop[
'parsedcomment'] );
77 $this->fld_timestamp = isset( $prop[
'timestamp'] );
78 $this->fld_sizes = isset( $prop[
'sizes'] );
79 $this->fld_patrol = isset( $prop[
'patrol'] );
80 $this->fld_notificationtimestamp = isset( $prop[
'notificationtimestamp'] );
81 $this->fld_loginfo = isset( $prop[
'loginfo'] );
83 if ( $this->fld_patrol ) {
84 if ( !
$user->useRCPatrol() && !
$user->useNPPatrol() ) {
85 $this->
dieWithError(
'apierror-permissiondenied-patrolflag',
'patrol' );
91 'dir' =>
$params[
'dir'] ===
'older'
96 if ( is_null( $resultPageSet ) ) {
110 if ( !is_null(
$params[
'continue'] ) ) {
111 $cont = explode(
'|',
$params[
'continue'] );
113 $continueTimestamp = $cont[0];
114 $continueId = (int)$cont[1];
116 $startFrom = [ $continueTimestamp, $continueId ];
119 if ( $wlowner !==
$user ) {
120 $options[
'watchlistOwner'] = $wlowner;
124 if ( !is_null(
$params[
'namespace'] ) ) {
132 if ( !is_null(
$params[
'show'] ) ) {
133 $show = array_flip(
$params[
'show'] );
144 if ( !
$user->useRCPatrol() && !
$user->useNPPatrol() ) {
145 $this->
dieWithError(
'apierror-permissiondenied-patrolflag',
'permissiondenied' );
149 $options[
'filters'] = array_keys( $show );
152 if ( !is_null(
$params[
'type'] ) ) {
158 }
catch ( Exception
$e ) {
164 if ( !is_null(
$params[
'user'] ) ) {
167 if ( !is_null(
$params[
'excludeuser'] ) ) {
173 Hooks::run(
'ApiQueryWatchlistPrepareWatchedItemQueryServiceOptions', [
179 $watchedItemQuery = MediaWikiServices::getInstance()->getWatchedItemQueryService();
180 $items = $watchedItemQuery->getWatchedItemsWithRecentChangeInfo( $wlowner,
$options, $startFrom );
182 foreach ( $items
as list ( $watchedItem, $recentChangeInfo ) ) {
184 if ( is_null( $resultPageSet ) ) {
188 $startFrom = [ $recentChangeInfo[
'rc_timestamp'], $recentChangeInfo[
'rc_id'] ];
193 $ids[] = intval( $recentChangeInfo[
'rc_this_oldid'] );
195 $ids[] = intval( $recentChangeInfo[
'rc_cur_id'] );
200 if ( $startFrom !==
null ) {
204 if ( is_null( $resultPageSet ) ) {
209 } elseif (
$params[
'allrev'] ) {
210 $resultPageSet->populateFromRevisionIDs( $ids );
212 $resultPageSet->populateFromPageIDs( $ids );
218 if ( $this->fld_flags ) {
221 if ( $this->fld_user || $this->fld_userid ) {
224 if ( $this->fld_user ) {
227 if ( $this->fld_comment || $this->fld_parsedcomment ) {
230 if ( $this->fld_patrol ) {
233 if ( $this->fld_sizes ) {
236 if ( $this->fld_loginfo ) {
239 return $includeFields;
265 $type = intval( $recentChangeInfo[
'rc_type'] );
270 if ( $this->fld_title || $this->fld_ids ) {
273 $vals[
'actionhidden'] =
true;
278 $recentChangeInfo[
'rc_deleted'],
283 if ( $this->fld_title ) {
286 if ( $this->fld_ids ) {
287 $vals[
'pageid'] = intval( $recentChangeInfo[
'rc_cur_id'] );
288 $vals[
'revid'] = intval( $recentChangeInfo[
'rc_this_oldid'] );
289 $vals[
'old_revid'] = intval( $recentChangeInfo[
'rc_last_oldid'] );
295 if ( $this->fld_user || $this->fld_userid ) {
297 $vals[
'userhidden'] =
true;
301 $recentChangeInfo[
'rc_deleted'],
305 if ( $this->fld_userid ) {
306 $vals[
'userid'] = (int)$recentChangeInfo[
'rc_user'];
308 $vals[
'user'] = (int)$recentChangeInfo[
'rc_user'];
311 if ( $this->fld_user ) {
312 $vals[
'user'] = $recentChangeInfo[
'rc_user_text'];
315 if ( !$recentChangeInfo[
'rc_user'] ) {
316 $vals[
'anon'] =
true;
322 if ( $this->fld_flags ) {
323 $vals[
'bot'] = (bool)$recentChangeInfo[
'rc_bot'];
324 $vals[
'new'] = $recentChangeInfo[
'rc_type'] ==
RC_NEW;
325 $vals[
'minor'] = (bool)$recentChangeInfo[
'rc_minor'];
329 if ( $this->fld_sizes ) {
330 $vals[
'oldlen'] = intval( $recentChangeInfo[
'rc_old_len'] );
331 $vals[
'newlen'] = intval( $recentChangeInfo[
'rc_new_len'] );
335 if ( $this->fld_timestamp ) {
336 $vals[
'timestamp'] =
wfTimestamp( TS_ISO_8601, $recentChangeInfo[
'rc_timestamp'] );
339 if ( $this->fld_notificationtimestamp ) {
346 if ( $this->fld_comment || $this->fld_parsedcomment ) {
348 $vals[
'commenthidden'] =
true;
352 $recentChangeInfo[
'rc_deleted'],
356 if ( $this->fld_comment && isset( $recentChangeInfo[
'rc_comment'] ) ) {
357 $vals[
'comment'] = $recentChangeInfo[
'rc_comment'];
360 if ( $this->fld_parsedcomment && isset( $recentChangeInfo[
'rc_comment'] ) ) {
367 if ( $this->fld_patrol ) {
368 $vals[
'patrolled'] = $recentChangeInfo[
'rc_patrolled'] == 1;
372 if ( $this->fld_loginfo && $recentChangeInfo[
'rc_type'] ==
RC_LOG ) {
374 $vals[
'actionhidden'] =
true;
378 $recentChangeInfo[
'rc_deleted'],
382 $vals[
'logid'] = intval( $recentChangeInfo[
'rc_logid'] );
383 $vals[
'logtype'] = $recentChangeInfo[
'rc_log_type'];
384 $vals[
'logaction'] = $recentChangeInfo[
'rc_log_action'];
390 $vals[
'suppressed'] =
true;
393 Hooks::run(
'ApiQueryWatchlistExtractOutputData', [
394 $this, $watchedItem, $recentChangeInfo, &$vals
449 'notificationtimestamp',
489 'action=query&list=watchlist'
490 =>
'apihelp-query+watchlist-example-simple',
491 'action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment'
492 =>
'apihelp-query+watchlist-example-props',
493 'action=query&list=watchlist&wlallrev=&wlprop=ids|title|timestamp|user|comment'
494 =>
'apihelp-query+watchlist-example-allrev',
495 'action=query&generator=watchlist&prop=info'
496 =>
'apihelp-query+watchlist-example-generator',
497 'action=query&generator=watchlist&gwlallrev=&prop=revisions&rvprop=timestamp|user'
498 =>
'apihelp-query+watchlist-example-generator-rev',
499 'action=query&list=watchlist&wlowner=Example&wltoken=123ABC'
500 =>
'apihelp-query+watchlist-example-wlowner',
505 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Watchlist';
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
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
static getChangeTypes()
Get an array of all change types.
$fld_notificationtimestamp
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
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
(null|boolean|integer|string) Default value of the parameter.
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
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.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
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
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.