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'
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'] );
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'] ) ) {
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 ) {
227 if ( $this->fld_user || $this->fld_userid ) {
230 if ( $this->fld_user ) {
233 if ( $this->fld_comment || $this->fld_parsedcomment ) {
236 if ( $this->fld_patrol ) {
239 if ( $this->fld_sizes ) {
242 if ( $this->fld_loginfo ) {
245 return $includeFields;
271 $type = intval( $recentChangeInfo[
'rc_type'] );
276 if ( $this->fld_title || $this->fld_ids ) {
279 $vals[
'actionhidden'] =
true;
284 $recentChangeInfo[
'rc_deleted'],
285 LogPage::DELETED_ACTION,
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'],
308 Revision::DELETED_USER,
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'],
359 Revision::DELETED_COMMENT,
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'],
385 LogPage::DELETED_ACTION,
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',
490 'action=query&list=watchlist'
491 =>
'apihelp-query+watchlist-example-simple',
492 'action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment'
493 =>
'apihelp-query+watchlist-example-props',
494 'action=query&list=watchlist&wlallrev=&wlprop=ids|title|timestamp|user|comment'
495 =>
'apihelp-query+watchlist-example-allrev',
496 'action=query&generator=watchlist&prop=info'
497 =>
'apihelp-query+watchlist-example-generator',
498 'action=query&generator=watchlist&gwlallrev=&prop=revisions&rvprop=timestamp|user'
499 =>
'apihelp-query+watchlist-example-generator-rev',
500 'action=query&list=watchlist&wlowner=Example&wltoken=123ABC'
501 =>
'apihelp-query+watchlist-example-wlowner',
506 return 'https://www.mediawiki.org/wiki/API:Watchlist';
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below...
__construct(ApiQuery $query, $moduleName)
const LIMIT_BIG2
Fast query, apihighlimits limit.
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
the array() calling protocol came about after MediaWiki 1.4rc1.
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
getResult()
Get the result object.
static getChangeTypes()
Get an array of all change types.
getWatchlistUser($params)
Gets the user for whom to get the watchlist.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
const LIMIT_BIG1
Fast query, standard limit.
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
extractRequestParams($parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user...
$fld_notificationtimestamp
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...
setContinueEnumParameter($paramName, $paramValue)
Overridden to set the generator param if in generator mode.
const TS_ISO_8601
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
const INCLUDE_PATROL_INFO
executeGenerator($resultPageSet)
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
showParamsConflicting(array $show)
const FILTER_NOT_PATROLLED
Representation of a pair of user and title for watchlist entries.
namespace and then decline to actually register it file or subcat img or subcat $title
getModuleName()
Get the name of the module being executed by this instance.
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right, for PARAM_TYPE 'limit'.
This is the main query class.
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
dieContinueUsageIf($condition)
Die with the $prefix.
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...
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter...
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
This query action allows clients to retrieve a list of recently modified pages that are part of the l...
static parseFromRCType($rcType)
Parsing RC_* constants to human-readable test.
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
static userCanBitfield($bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row, if it's marked as deleted.
extractOutputData(WatchedItem $watchedItem, array $recentChangeInfo)
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
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...
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, if it's marked as deleted.
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
static dieDebug($method, $message)
Internal code errors should be reported with this method.
static isUnpatrolled($rc, User $user)
static addTitleInfo(&$arr, $title, $prefix= '')
Add information (title and namespace) about a Title object to a result array.
static parseToRCType($type)
Parsing text to RC_* constants.
getUser()
Get the User object.
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
static makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
dieUsageMsg($error)
Output the error message related to a certain array.
selectNamedDB($name, $db, $groups)
Selects the query database connection with the given name.