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->
dieUsage(
'patrol property is not available',
'patrol' );
91 'dir' =>
$params[
'dir'] ===
'older'
92 ? WatchedItemQueryService::DIR_OLDER
93 : WatchedItemQueryService::DIR_NEWER,
96 if ( is_null( $resultPageSet ) ) {
109 if ( !is_null(
$params[
'continue'] ) ) {
110 $cont = explode(
'|',
$params[
'continue'] );
112 $continueTimestamp = $cont[0];
113 $continueId = (int)$cont[1];
115 $options[
'startFrom'] = [ $continueTimestamp, $continueId ];
118 if ( $wlowner !==
$user ) {
119 $options[
'watchlistOwner'] = $wlowner;
123 if ( !is_null(
$params[
'namespace'] ) ) {
131 if ( !is_null(
$params[
'show'] ) ) {
132 $show = array_flip(
$params[
'show'] );
140 if ( isset( $show[WatchedItemQueryService::FILTER_PATROLLED] )
141 || isset( $show[WatchedItemQueryService::FILTER_NOT_PATROLLED] )
143 if ( !
$user->useRCPatrol() && !
$user->useNPPatrol() ) {
145 'You need the patrol right to request the patrolled flag',
151 $options[
'filters'] = array_keys( $show );
154 if ( !is_null(
$params[
'type'] ) ) {
157 }
catch ( Exception
$e ) {
162 if ( !is_null(
$params[
'user'] ) && !is_null(
$params[
'excludeuser'] ) ) {
163 $this->
dieUsage(
'user and excludeuser cannot be used together',
'user-excludeuser' );
165 if ( !is_null(
$params[
'user'] ) ) {
168 if ( !is_null(
$params[
'excludeuser'] ) ) {
176 $watchedItemQuery = MediaWikiServices::getInstance()->getWatchedItemQueryService();
177 $items = $watchedItemQuery->getWatchedItemsWithRecentChangeInfo( $wlowner,
$options );
179 foreach ( $items
as list ( $watchedItem, $recentChangeInfo ) ) {
186 $recentChangeInfo[
'rc_timestamp'] .
'|' . $recentChangeInfo[
'rc_id']
191 if ( is_null( $resultPageSet ) ) {
197 $recentChangeInfo[
'rc_timestamp'] .
'|' . $recentChangeInfo[
'rc_id']
203 $ids[] = intval( $recentChangeInfo[
'rc_this_oldid'] );
205 $ids[] = intval( $recentChangeInfo[
'rc_cur_id'] );
210 if ( is_null( $resultPageSet ) ) {
215 } elseif (
$params[
'allrev'] ) {
216 $resultPageSet->populateFromRevisionIDs( $ids );
218 $resultPageSet->populateFromPageIDs( $ids );
224 if ( $this->fld_flags ) {
225 $includeFields[] = WatchedItemQueryService::INCLUDE_FLAGS;
227 if ( $this->fld_user || $this->fld_userid ) {
228 $includeFields[] = WatchedItemQueryService::INCLUDE_USER_ID;
230 if ( $this->fld_user ) {
231 $includeFields[] = WatchedItemQueryService::INCLUDE_USER;
233 if ( $this->fld_comment || $this->fld_parsedcomment ) {
234 $includeFields[] = WatchedItemQueryService::INCLUDE_COMMENT;
236 if ( $this->fld_patrol ) {
237 $includeFields[] = WatchedItemQueryService::INCLUDE_PATROL_INFO;
239 if ( $this->fld_sizes ) {
240 $includeFields[] = WatchedItemQueryService::INCLUDE_SIZES;
242 if ( $this->fld_loginfo ) {
243 $includeFields[] = WatchedItemQueryService::INCLUDE_LOG_INFO;
245 return $includeFields;
249 return ( isset( $show[WatchedItemQueryService::FILTER_MINOR] )
250 && isset( $show[WatchedItemQueryService::FILTER_NOT_MINOR] ) )
251 || ( isset( $show[WatchedItemQueryService::FILTER_BOT] )
252 && isset( $show[WatchedItemQueryService::FILTER_NOT_BOT] ) )
253 || ( isset( $show[WatchedItemQueryService::FILTER_ANON] )
254 && isset( $show[WatchedItemQueryService::FILTER_NOT_ANON] ) )
255 || ( isset( $show[WatchedItemQueryService::FILTER_PATROLLED] )
256 && isset( $show[WatchedItemQueryService::FILTER_NOT_PATROLLED] ) )
257 || ( isset( $show[WatchedItemQueryService::FILTER_UNREAD] )
258 && isset( $show[WatchedItemQueryService::FILTER_NOT_UNREAD] ) );
263 $title = Title::makeTitle(
271 $type = intval( $recentChangeInfo[
'rc_type'] );
276 if ( $this->fld_title || $this->fld_ids ) {
279 $vals[
'actionhidden'] =
true;
284 $recentChangeInfo[
'rc_deleted'],
289 if ( $this->fld_title ) {
292 if ( $this->fld_ids ) {
293 $vals[
'pageid'] = intval( $recentChangeInfo[
'rc_cur_id'] );
294 $vals[
'revid'] = intval( $recentChangeInfo[
'rc_this_oldid'] );
295 $vals[
'old_revid'] = intval( $recentChangeInfo[
'rc_last_oldid'] );
301 if ( $this->fld_user || $this->fld_userid ) {
303 $vals[
'userhidden'] =
true;
307 $recentChangeInfo[
'rc_deleted'],
311 if ( $this->fld_userid ) {
312 $vals[
'userid'] = (int)$recentChangeInfo[
'rc_user'];
314 $vals[
'user'] = (int)$recentChangeInfo[
'rc_user'];
317 if ( $this->fld_user ) {
318 $vals[
'user'] = $recentChangeInfo[
'rc_user_text'];
321 if ( !$recentChangeInfo[
'rc_user'] ) {
322 $vals[
'anon'] =
true;
328 if ( $this->fld_flags ) {
329 $vals[
'bot'] = (bool)$recentChangeInfo[
'rc_bot'];
330 $vals[
'new'] = $recentChangeInfo[
'rc_type'] ==
RC_NEW;
331 $vals[
'minor'] = (bool)$recentChangeInfo[
'rc_minor'];
335 if ( $this->fld_sizes ) {
336 $vals[
'oldlen'] = intval( $recentChangeInfo[
'rc_old_len'] );
337 $vals[
'newlen'] = intval( $recentChangeInfo[
'rc_new_len'] );
341 if ( $this->fld_timestamp ) {
345 if ( $this->fld_notificationtimestamp ) {
352 if ( $this->fld_comment || $this->fld_parsedcomment ) {
354 $vals[
'commenthidden'] =
true;
358 $recentChangeInfo[
'rc_deleted'],
362 if ( $this->fld_comment && isset( $recentChangeInfo[
'rc_comment'] ) ) {
363 $vals[
'comment'] = $recentChangeInfo[
'rc_comment'];
366 if ( $this->fld_parsedcomment && isset( $recentChangeInfo[
'rc_comment'] ) ) {
373 if ( $this->fld_patrol ) {
374 $vals[
'patrolled'] = $recentChangeInfo[
'rc_patrolled'] == 1;
378 if ( $this->fld_loginfo && $recentChangeInfo[
'rc_type'] ==
RC_LOG ) {
380 $vals[
'actionhidden'] =
true;
384 $recentChangeInfo[
'rc_deleted'],
388 $vals[
'logid'] = intval( $recentChangeInfo[
'rc_logid'] );
389 $vals[
'logtype'] = $recentChangeInfo[
'rc_log_type'];
390 $vals[
'logaction'] = $recentChangeInfo[
'rc_log_action'];
396 $vals[
'suppressed'] =
true;
451 'notificationtimestamp',
458 WatchedItemQueryService::FILTER_MINOR,
459 WatchedItemQueryService::FILTER_NOT_MINOR,
460 WatchedItemQueryService::FILTER_BOT,
461 WatchedItemQueryService::FILTER_NOT_BOT,
462 WatchedItemQueryService::FILTER_ANON,
463 WatchedItemQueryService::FILTER_NOT_ANON,
464 WatchedItemQueryService::FILTER_PATROLLED,
465 WatchedItemQueryService::FILTER_NOT_PATROLLED,
466 WatchedItemQueryService::FILTER_UNREAD,
467 WatchedItemQueryService::FILTER_NOT_UNREAD,
491 'action=query&list=watchlist'
492 =>
'apihelp-query+watchlist-example-simple',
493 'action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment'
494 =>
'apihelp-query+watchlist-example-props',
495 'action=query&list=watchlist&wlallrev=&wlprop=ids|title|timestamp|user|comment'
496 =>
'apihelp-query+watchlist-example-allrev',
497 'action=query&generator=watchlist&prop=info'
498 =>
'apihelp-query+watchlist-example-generator',
499 'action=query&generator=watchlist&gwlallrev=&prop=revisions&rvprop=timestamp|user'
500 =>
'apihelp-query+watchlist-example-generator-rev',
501 'action=query&list=watchlist&wlowner=Example&wltoken=123ABC'
502 =>
'apihelp-query+watchlist-example-wlowner',
507 return 'https://www.mediawiki.org/wiki/API:Watchlist';
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right,...
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
getWatchlistUser( $params)
Gets the user for whom to get the watchlist.
dieContinueUsageIf( $condition)
Die with the $prefix.
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
const PARAM_SENSITIVE
(boolean) Is the parameter sensitive? Note 'password'-type fields are always sensitive regardless of ...
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
dieUsageMsg( $error)
Output the error message related to a certain array.
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
const LIMIT_BIG1
Fast query, standard limit.
getResult()
Get the result object.
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
const LIMIT_BIG2
Fast query, apihighlimits limit.
getModuleName()
Get the name of the module being executed by this instance.
dieUsage( $description, $errorCode, $httpRespCode=0, $extradata=null)
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an...
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
selectNamedDB( $name, $db, $groups)
Selects the query database connection with the given name.
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...
run( $resultPageSet=null)
$fld_notificationtimestamp
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
extractOutputData(WatchedItem $watchedItem, array $recentChangeInfo)
showParamsConflicting(array $show)
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getExamplesMessages()
Returns usage examples for this module.
getHelpUrls()
Return links to more detailed help pages about the module.
executeGenerator( $resultPageSet)
Execute this module as a generator.
__construct(ApiQuery $query, $moduleName)
This is the main query class.
static isUnpatrolled( $rc, User $user)
getUser()
Get the User object.
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...
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
static parseToRCType( $type)
Parsing text to RC_* constants.
static getChangeTypes()
Get an array of all change types.
static parseFromRCType( $rcType)
Parsing RC_* constants to human-readable test.
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,...
Representation of a pair of user and title for watchlist entries.
getNotificationTimestamp()
Get the notification timestamp of this entry.
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
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
the array() calling protocol came about after MediaWiki 1.4rc1.
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 local account $user
namespace are movable Hooks may change this value to override the return value of MWNamespace::isMovable(). 'NewDifferenceEngine' 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 one of or reset 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
namespace and then decline to actually register it file or subcat img or subcat $title
null for the local 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
returning false will NOT prevent logging $e
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 TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.