MediaWiki  1.29.1
ApiQueryWatchlist.php
Go to the documentation of this file.
1 <?php
28 
36 
37  public function __construct( ApiQuery $query, $moduleName ) {
38  parent::__construct( $query, $moduleName, 'wl' );
39  }
40 
41  public function execute() {
42  $this->run();
43  }
44 
45  public function executeGenerator( $resultPageSet ) {
46  $this->run( $resultPageSet );
47  }
48 
49  private $fld_ids = false, $fld_title = false, $fld_patrol = false,
50  $fld_flags = false, $fld_timestamp = false, $fld_user = false,
51  $fld_comment = false, $fld_parsedcomment = false, $fld_sizes = false,
53  $fld_loginfo = false;
54 
59  private function run( $resultPageSet = null ) {
60  $this->selectNamedDB( 'watchlist', DB_REPLICA, 'watchlist' );
61 
62  $params = $this->extractRequestParams();
63 
64  $user = $this->getUser();
65  $wlowner = $this->getWatchlistUser( $params );
66 
67  if ( !is_null( $params['prop'] ) && is_null( $resultPageSet ) ) {
68  $prop = array_flip( $params['prop'] );
69 
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'] );
82 
83  if ( $this->fld_patrol ) {
84  if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
85  $this->dieWithError( 'apierror-permissiondenied-patrolflag', 'patrol' );
86  }
87  }
88  }
89 
90  $options = [
91  'dir' => $params['dir'] === 'older'
94  ];
95 
96  if ( is_null( $resultPageSet ) ) {
97  $options['includeFields'] = $this->getFieldsToInclude();
98  } else {
99  $options['usedInGenerator'] = true;
100  }
101 
102  if ( $params['start'] ) {
103  $options['start'] = $params['start'];
104  }
105  if ( $params['end'] ) {
106  $options['end'] = $params['end'];
107  }
108 
109  $startFrom = null;
110  if ( !is_null( $params['continue'] ) ) {
111  $cont = explode( '|', $params['continue'] );
112  $this->dieContinueUsageIf( count( $cont ) != 2 );
113  $continueTimestamp = $cont[0];
114  $continueId = (int)$cont[1];
115  $this->dieContinueUsageIf( $continueId != $cont[1] );
116  $startFrom = [ $continueTimestamp, $continueId ];
117  }
118 
119  if ( $wlowner !== $user ) {
120  $options['watchlistOwner'] = $wlowner;
121  $options['watchlistOwnerToken'] = $params['token'];
122  }
123 
124  if ( !is_null( $params['namespace'] ) ) {
125  $options['namespaceIds'] = $params['namespace'];
126  }
127 
128  if ( $params['allrev'] ) {
129  $options['allRevisions'] = true;
130  }
131 
132  if ( !is_null( $params['show'] ) ) {
133  $show = array_flip( $params['show'] );
134 
135  /* Check for conflicting parameters. */
136  if ( $this->showParamsConflicting( $show ) ) {
137  $this->dieWithError( 'apierror-show' );
138  }
139 
140  // Check permissions.
141  if ( isset( $show[WatchedItemQueryService::FILTER_PATROLLED] )
143  ) {
144  if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
145  $this->dieWithError( 'apierror-permissiondenied-patrolflag', 'permissiondenied' );
146  }
147  }
148 
149  $options['filters'] = array_keys( $show );
150  }
151 
152  if ( !is_null( $params['type'] ) ) {
153  try {
154  $rcTypes = RecentChange::parseToRCType( $params['type'] );
155  if ( $rcTypes ) {
156  $options['rcTypes'] = $rcTypes;
157  }
158  } catch ( Exception $e ) {
159  ApiBase::dieDebug( __METHOD__, $e->getMessage() );
160  }
161  }
162 
163  $this->requireMaxOneParameter( $params, 'user', 'excludeuser' );
164  if ( !is_null( $params['user'] ) ) {
165  $options['onlyByUser'] = $params['user'];
166  }
167  if ( !is_null( $params['excludeuser'] ) ) {
168  $options['notByUser'] = $params['excludeuser'];
169  }
170 
171  $options['limit'] = $params['limit'];
172 
173  Hooks::run( 'ApiQueryWatchlistPrepareWatchedItemQueryServiceOptions', [
174  $this, $params, &$options
175  ] );
176 
177  $ids = [];
178  $count = 0;
179  $watchedItemQuery = MediaWikiServices::getInstance()->getWatchedItemQueryService();
180  $items = $watchedItemQuery->getWatchedItemsWithRecentChangeInfo( $wlowner, $options, $startFrom );
181 
182  foreach ( $items as list ( $watchedItem, $recentChangeInfo ) ) {
184  if ( is_null( $resultPageSet ) ) {
185  $vals = $this->extractOutputData( $watchedItem, $recentChangeInfo );
186  $fit = $this->getResult()->addValue( [ 'query', $this->getModuleName() ], null, $vals );
187  if ( !$fit ) {
188  $startFrom = [ $recentChangeInfo['rc_timestamp'], $recentChangeInfo['rc_id'] ];
189  break;
190  }
191  } else {
192  if ( $params['allrev'] ) {
193  $ids[] = intval( $recentChangeInfo['rc_this_oldid'] );
194  } else {
195  $ids[] = intval( $recentChangeInfo['rc_cur_id'] );
196  }
197  }
198  }
199 
200  if ( $startFrom !== null ) {
201  $this->setContinueEnumParameter( 'continue', implode( '|', $startFrom ) );
202  }
203 
204  if ( is_null( $resultPageSet ) ) {
205  $this->getResult()->addIndexedTagName(
206  [ 'query', $this->getModuleName() ],
207  'item'
208  );
209  } elseif ( $params['allrev'] ) {
210  $resultPageSet->populateFromRevisionIDs( $ids );
211  } else {
212  $resultPageSet->populateFromPageIDs( $ids );
213  }
214  }
215 
216  private function getFieldsToInclude() {
217  $includeFields = [];
218  if ( $this->fld_flags ) {
219  $includeFields[] = WatchedItemQueryService::INCLUDE_FLAGS;
220  }
221  if ( $this->fld_user || $this->fld_userid ) {
222  $includeFields[] = WatchedItemQueryService::INCLUDE_USER_ID;
223  }
224  if ( $this->fld_user ) {
225  $includeFields[] = WatchedItemQueryService::INCLUDE_USER;
226  }
227  if ( $this->fld_comment || $this->fld_parsedcomment ) {
228  $includeFields[] = WatchedItemQueryService::INCLUDE_COMMENT;
229  }
230  if ( $this->fld_patrol ) {
232  }
233  if ( $this->fld_sizes ) {
234  $includeFields[] = WatchedItemQueryService::INCLUDE_SIZES;
235  }
236  if ( $this->fld_loginfo ) {
238  }
239  return $includeFields;
240  }
241 
242  private function showParamsConflicting( array $show ) {
243  return ( isset( $show[WatchedItemQueryService::FILTER_MINOR] )
244  && isset( $show[WatchedItemQueryService::FILTER_NOT_MINOR] ) )
245  || ( isset( $show[WatchedItemQueryService::FILTER_BOT] )
246  && isset( $show[WatchedItemQueryService::FILTER_NOT_BOT] ) )
247  || ( isset( $show[WatchedItemQueryService::FILTER_ANON] )
248  && isset( $show[WatchedItemQueryService::FILTER_NOT_ANON] ) )
249  || ( isset( $show[WatchedItemQueryService::FILTER_PATROLLED] )
251  || ( isset( $show[WatchedItemQueryService::FILTER_UNREAD] )
252  && isset( $show[WatchedItemQueryService::FILTER_NOT_UNREAD] ) );
253  }
254 
255  private function extractOutputData( WatchedItem $watchedItem, array $recentChangeInfo ) {
256  /* Determine the title of the page that has been changed. */
258  $watchedItem->getLinkTarget()->getNamespace(),
259  $watchedItem->getLinkTarget()->getDBkey()
260  );
261  $user = $this->getUser();
262 
263  /* Our output data. */
264  $vals = [];
265  $type = intval( $recentChangeInfo['rc_type'] );
266  $vals['type'] = RecentChange::parseFromRCType( $type );
267  $anyHidden = false;
268 
269  /* Create a new entry in the result for the title. */
270  if ( $this->fld_title || $this->fld_ids ) {
271  // These should already have been filtered out of the query, but just in case.
272  if ( $type === RC_LOG && ( $recentChangeInfo['rc_deleted'] & LogPage::DELETED_ACTION ) ) {
273  $vals['actionhidden'] = true;
274  $anyHidden = true;
275  }
276  if ( $type !== RC_LOG ||
278  $recentChangeInfo['rc_deleted'],
280  $user
281  )
282  ) {
283  if ( $this->fld_title ) {
285  }
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'] );
290  }
291  }
292  }
293 
294  /* Add user data and 'anon' flag, if user is anonymous. */
295  if ( $this->fld_user || $this->fld_userid ) {
296  if ( $recentChangeInfo['rc_deleted'] & Revision::DELETED_USER ) {
297  $vals['userhidden'] = true;
298  $anyHidden = true;
299  }
301  $recentChangeInfo['rc_deleted'],
303  $user
304  ) ) {
305  if ( $this->fld_userid ) {
306  $vals['userid'] = (int)$recentChangeInfo['rc_user'];
307  // for backwards compatibility
308  $vals['user'] = (int)$recentChangeInfo['rc_user'];
309  }
310 
311  if ( $this->fld_user ) {
312  $vals['user'] = $recentChangeInfo['rc_user_text'];
313  }
314 
315  if ( !$recentChangeInfo['rc_user'] ) {
316  $vals['anon'] = true;
317  }
318  }
319  }
320 
321  /* Add flags, such as new, minor, bot. */
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'];
326  }
327 
328  /* Add sizes of each revision. (Only available on 1.10+) */
329  if ( $this->fld_sizes ) {
330  $vals['oldlen'] = intval( $recentChangeInfo['rc_old_len'] );
331  $vals['newlen'] = intval( $recentChangeInfo['rc_new_len'] );
332  }
333 
334  /* Add the timestamp. */
335  if ( $this->fld_timestamp ) {
336  $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $recentChangeInfo['rc_timestamp'] );
337  }
338 
339  if ( $this->fld_notificationtimestamp ) {
340  $vals['notificationtimestamp'] = ( $watchedItem->getNotificationTimestamp() == null )
341  ? ''
342  : wfTimestamp( TS_ISO_8601, $watchedItem->getNotificationTimestamp() );
343  }
344 
345  /* Add edit summary / log summary. */
346  if ( $this->fld_comment || $this->fld_parsedcomment ) {
347  if ( $recentChangeInfo['rc_deleted'] & Revision::DELETED_COMMENT ) {
348  $vals['commenthidden'] = true;
349  $anyHidden = true;
350  }
352  $recentChangeInfo['rc_deleted'],
354  $user
355  ) ) {
356  if ( $this->fld_comment && isset( $recentChangeInfo['rc_comment'] ) ) {
357  $vals['comment'] = $recentChangeInfo['rc_comment'];
358  }
359 
360  if ( $this->fld_parsedcomment && isset( $recentChangeInfo['rc_comment'] ) ) {
361  $vals['parsedcomment'] = Linker::formatComment( $recentChangeInfo['rc_comment'], $title );
362  }
363  }
364  }
365 
366  /* Add the patrolled flag */
367  if ( $this->fld_patrol ) {
368  $vals['patrolled'] = $recentChangeInfo['rc_patrolled'] == 1;
369  $vals['unpatrolled'] = ChangesList::isUnpatrolled( (object)$recentChangeInfo, $user );
370  }
371 
372  if ( $this->fld_loginfo && $recentChangeInfo['rc_type'] == RC_LOG ) {
373  if ( $recentChangeInfo['rc_deleted'] & LogPage::DELETED_ACTION ) {
374  $vals['actionhidden'] = true;
375  $anyHidden = true;
376  }
378  $recentChangeInfo['rc_deleted'],
380  $user
381  ) ) {
382  $vals['logid'] = intval( $recentChangeInfo['rc_logid'] );
383  $vals['logtype'] = $recentChangeInfo['rc_log_type'];
384  $vals['logaction'] = $recentChangeInfo['rc_log_action'];
385  $vals['logparams'] = LogFormatter::newFromRow( $recentChangeInfo )->formatParametersForApi();
386  }
387  }
388 
389  if ( $anyHidden && ( $recentChangeInfo['rc_deleted'] & Revision::DELETED_RESTRICTED ) ) {
390  $vals['suppressed'] = true;
391  }
392 
393  Hooks::run( 'ApiQueryWatchlistExtractOutputData', [
394  $this, $watchedItem, $recentChangeInfo, &$vals
395  ] );
396 
397  return $vals;
398  }
399 
400  public function getAllowedParams() {
401  return [
402  'allrev' => false,
403  'start' => [
404  ApiBase::PARAM_TYPE => 'timestamp'
405  ],
406  'end' => [
407  ApiBase::PARAM_TYPE => 'timestamp'
408  ],
409  'namespace' => [
410  ApiBase::PARAM_ISMULTI => true,
411  ApiBase::PARAM_TYPE => 'namespace'
412  ],
413  'user' => [
414  ApiBase::PARAM_TYPE => 'user',
415  ],
416  'excludeuser' => [
417  ApiBase::PARAM_TYPE => 'user',
418  ],
419  'dir' => [
420  ApiBase::PARAM_DFLT => 'older',
422  'newer',
423  'older'
424  ],
425  ApiHelp::PARAM_HELP_MSG => 'api-help-param-direction',
426  ],
427  'limit' => [
428  ApiBase::PARAM_DFLT => 10,
429  ApiBase::PARAM_TYPE => 'limit',
430  ApiBase::PARAM_MIN => 1,
433  ],
434  'prop' => [
435  ApiBase::PARAM_ISMULTI => true,
436  ApiBase::PARAM_DFLT => 'ids|title|flags',
439  'ids',
440  'title',
441  'flags',
442  'user',
443  'userid',
444  'comment',
445  'parsedcomment',
446  'timestamp',
447  'patrol',
448  'sizes',
449  'notificationtimestamp',
450  'loginfo',
451  ]
452  ],
453  'show' => [
454  ApiBase::PARAM_ISMULTI => true,
466  ]
467  ],
468  'type' => [
469  ApiBase::PARAM_DFLT => 'edit|new|log|categorize',
470  ApiBase::PARAM_ISMULTI => true,
473  ],
474  'owner' => [
475  ApiBase::PARAM_TYPE => 'user'
476  ],
477  'token' => [
478  ApiBase::PARAM_TYPE => 'string',
479  ApiBase::PARAM_SENSITIVE => true,
480  ],
481  'continue' => [
482  ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
483  ],
484  ];
485  }
486 
487  protected function getExamplesMessages() {
488  return [
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',
501  ];
502  }
503 
504  public function getHelpUrls() {
505  return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Watchlist';
506  }
507 }
Revision\DELETED_USER
const DELETED_USER
Definition: Revision.php:92
Revision\DELETED_RESTRICTED
const DELETED_RESTRICTED
Definition: Revision.php:93
ApiQueryWatchlist\$fld_title
$fld_title
Definition: ApiQueryWatchlist.php:49
ApiQuery
This is the main query class.
Definition: ApiQuery.php:40
Revision\DELETED_COMMENT
const DELETED_COMMENT
Definition: Revision.php:91
WatchedItemQueryService\INCLUDE_COMMENT
const INCLUDE_COMMENT
Definition: WatchedItemQueryService.php:26
Revision\userCanBitfield
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,...
Definition: Revision.php:1779
WatchedItemQueryService\FILTER_PATROLLED
const FILTER_PATROLLED
Definition: WatchedItemQueryService.php:40
captcha-old.count
count
Definition: captcha-old.py:225
ApiQueryWatchlist\$fld_user
$fld_user
Definition: ApiQueryWatchlist.php:50
ApiBase\dieWithError
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
Definition: ApiBase.php:1796
ApiBase\PARAM_HELP_MSG
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
Definition: ApiBase.php:128
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1994
ApiBase\PARAM_TYPE
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
Definition: ApiBase.php:91
ApiBase\getResult
getResult()
Get the result object.
Definition: ApiBase.php:610
RC_LOG
const RC_LOG
Definition: Defines.php:142
use
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
Definition: MIT-LICENSE.txt:10
ApiQueryWatchlist\$fld_userid
$fld_userid
Definition: ApiQueryWatchlist.php:52
$user
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
Definition: hooks.txt:246
RecentChange\getChangeTypes
static getChangeTypes()
Get an array of all change types.
Definition: RecentChange.php:162
$params
$params
Definition: styleTest.css.php:40
ApiQueryWatchlist\$fld_loginfo
$fld_loginfo
Definition: ApiQueryWatchlist.php:53
ApiQueryWatchlist\$fld_notificationtimestamp
$fld_notificationtimestamp
Definition: ApiQueryWatchlist.php:52
$type
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
Definition: hooks.txt:2536
RecentChange\parseToRCType
static parseToRCType( $type)
Parsing text to RC_* constants.
Definition: RecentChange.php:129
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:133
ApiQueryBase\$options
$options
Definition: ApiQueryBase.php:39
php
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
Definition: injection.txt:35
ApiBase\PARAM_SENSITIVE
const PARAM_SENSITIVE
(null|boolean|integer|string) Default value of the parameter.
Definition: ApiBase.php:196
WatchedItemQueryService\INCLUDE_LOG_INFO
const INCLUDE_LOG_INFO
Definition: WatchedItemQueryService.php:29
ApiQueryGeneratorBase\setContinueEnumParameter
setContinueEnumParameter( $paramName, $paramValue)
Overridden to set the generator param if in generator mode.
Definition: ApiQueryGeneratorBase.php:88
$query
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
Definition: hooks.txt:1572
ApiBase\PARAM_MIN
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition: ApiBase.php:103
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:934
LogFormatter\newFromRow
static newFromRow( $row)
Handy shortcut for constructing a formatter directly from database row.
Definition: LogFormatter.php:74
ApiQueryWatchlist\$fld_sizes
$fld_sizes
Definition: ApiQueryWatchlist.php:51
WatchedItemQueryService\FILTER_MINOR
const FILTER_MINOR
Definition: WatchedItemQueryService.php:34
WatchedItemQueryService\INCLUDE_USER
const INCLUDE_USER
Definition: WatchedItemQueryService.php:24
ApiBase\LIMIT_BIG1
const LIMIT_BIG1
Fast query, standard limit.
Definition: ApiBase.php:203
WatchedItemQueryService\FILTER_NOT_BOT
const FILTER_NOT_BOT
Definition: WatchedItemQueryService.php:37
WatchedItemQueryService\INCLUDE_PATROL_INFO
const INCLUDE_PATROL_INFO
Definition: WatchedItemQueryService.php:27
ApiBase\PARAM_MAX
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Definition: ApiBase.php:94
ApiQueryWatchlist\getAllowedParams
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Definition: ApiQueryWatchlist.php:400
ApiQueryWatchlist\getFieldsToInclude
getFieldsToInclude()
Definition: ApiQueryWatchlist.php:216
WatchedItemQueryService\FILTER_BOT
const FILTER_BOT
Definition: WatchedItemQueryService.php:36
WatchedItemQueryService\INCLUDE_USER_ID
const INCLUDE_USER_ID
Definition: WatchedItemQueryService.php:25
ApiQueryWatchlist\executeGenerator
executeGenerator( $resultPageSet)
Execute this module as a generator.
Definition: ApiQueryWatchlist.php:45
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:514
ApiQueryWatchlist\showParamsConflicting
showParamsConflicting(array $show)
Definition: ApiQueryWatchlist.php:242
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
list
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
Definition: deferred.txt:11
LogPage\DELETED_ACTION
const DELETED_ACTION
Definition: LogPage.php:32
WatchedItemQueryService\DIR_NEWER
const DIR_NEWER
Definition: WatchedItemQueryService.php:21
ApiBase\extractRequestParams
extractRequestParams( $parseLimit=true)
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition: ApiBase.php:718
ApiBase\getWatchlistUser
getWatchlistUser( $params)
Gets the user for whom to get the watchlist.
Definition: ApiBase.php:1588
$e
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Definition: hooks.txt:2122
ApiBase\dieContinueUsageIf
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
Definition: ApiBase.php:1950
WatchedItem
Representation of a pair of user and title for watchlist entries.
Definition: WatchedItem.php:32
WatchedItemQueryService\FILTER_NOT_PATROLLED
const FILTER_NOT_PATROLLED
Definition: WatchedItemQueryService.php:41
ApiQueryWatchlist\$fld_timestamp
$fld_timestamp
Definition: ApiQueryWatchlist.php:50
WatchedItemQueryService\FILTER_NOT_MINOR
const FILTER_NOT_MINOR
Definition: WatchedItemQueryService.php:35
RC_NEW
const RC_NEW
Definition: Defines.php:141
WatchedItemQueryService\INCLUDE_FLAGS
const INCLUDE_FLAGS
Definition: WatchedItemQueryService.php:23
ApiBase\requireMaxOneParameter
requireMaxOneParameter( $params, $required)
Die if more than one of a certain set of parameters is set and not false.
Definition: ApiBase.php:792
ApiQueryWatchlist\extractOutputData
extractOutputData(WatchedItem $watchedItem, array $recentChangeInfo)
Definition: ApiQueryWatchlist.php:255
Linker\formatComment
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...
Definition: Linker.php:1094
ApiQueryGeneratorBase
Definition: ApiQueryGeneratorBase.php:30
WatchedItemQueryService\DIR_OLDER
const DIR_OLDER
Definition: WatchedItemQueryService.php:20
ApiQueryWatchlist\getHelpUrls
getHelpUrls()
Return links to more detailed help pages about the module.
Definition: ApiQueryWatchlist.php:504
ApiQueryWatchlist
This query action allows clients to retrieve a list of recently modified pages that are part of the l...
Definition: ApiQueryWatchlist.php:35
ApiQueryBase\selectNamedDB
selectNamedDB( $name, $db, $groups)
Selects the query database connection with the given name.
Definition: ApiQueryBase.php:127
ApiQueryWatchlist\$fld_ids
$fld_ids
Definition: ApiQueryWatchlist.php:49
ApiBase\LIMIT_BIG2
const LIMIT_BIG2
Fast query, apihighlimits limit.
Definition: ApiBase.php:205
LogEventsList\userCanBitfield
static userCanBitfield( $bitfield, $field, User $user=null)
Determine if the current user is allowed to view a particular field of this log row,...
Definition: LogEventsList.php:512
WatchedItemQueryService\FILTER_NOT_UNREAD
const FILTER_NOT_UNREAD
Definition: WatchedItemQueryService.php:43
RecentChange\parseFromRCType
static parseFromRCType( $rcType)
Parsing RC_* constants to human-readable test.
Definition: RecentChange.php:151
ApiQueryWatchlist\$fld_patrol
$fld_patrol
Definition: ApiQueryWatchlist.php:49
ApiBase\PARAM_DFLT
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
Definition: ApiBase.php:52
as
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
Definition: distributors.txt:9
ApiBase\getModuleName
getModuleName()
Get the name of the module being executed by this instance.
Definition: ApiBase.php:490
WatchedItem\getLinkTarget
getLinkTarget()
Definition: WatchedItem.php:106
ApiBase\PARAM_ISMULTI
const PARAM_ISMULTI
(boolean) Accept multiple pipe-separated values for this parameter (e.g.
Definition: ApiBase.php:55
WatchedItemQueryService\FILTER_NOT_ANON
const FILTER_NOT_ANON
Definition: WatchedItemQueryService.php:39
ApiQueryWatchlist\$fld_comment
$fld_comment
Definition: ApiQueryWatchlist.php:51
ApiBase\PARAM_MAX2
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right,...
Definition: ApiBase.php:100
ApiQueryWatchlist\execute
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
Definition: ApiQueryWatchlist.php:41
WatchedItem\getNotificationTimestamp
getNotificationTimestamp()
Get the notification timestamp of this entry.
Definition: WatchedItem.php:115
ChangesList\isUnpatrolled
static isUnpatrolled( $rc, User $user)
Definition: ChangesList.php:702
ApiQueryWatchlist\getExamplesMessages
getExamplesMessages()
Returns usage examples for this module.
Definition: ApiQueryWatchlist.php:487
WatchedItemQueryService\INCLUDE_SIZES
const INCLUDE_SIZES
Definition: WatchedItemQueryService.php:28
ApiQueryWatchlist\$fld_parsedcomment
$fld_parsedcomment
Definition: ApiQueryWatchlist.php:51
MediaWikiServices
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
Definition: injection.txt:23
ApiBase\PARAM_HELP_MSG_PER_VALUE
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
Definition: ApiBase.php:160
ApiQueryWatchlist\run
run( $resultPageSet=null)
Definition: ApiQueryWatchlist.php:59
WatchedItemQueryService\FILTER_ANON
const FILTER_ANON
Definition: WatchedItemQueryService.php:38
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
ApiBase\dieDebug
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
Definition: ApiBase.php:1962
WatchedItemQueryService\FILTER_UNREAD
const FILTER_UNREAD
Definition: WatchedItemQueryService.php:42
ApiQueryWatchlist\$fld_flags
$fld_flags
Definition: ApiQueryWatchlist.php:50
ApiQueryBase\addTitleInfo
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
Definition: ApiQueryBase.php:486
ApiQueryWatchlist\__construct
__construct(ApiQuery $query, $moduleName)
Definition: ApiQueryWatchlist.php:37
array
the array() calling protocol came about after MediaWiki 1.4rc1.