Improve docs for Title::getInternalURL/getCanonicalURL
[lhc/web/wiklou.git] / docs / hooks.txt
1 hooks.txt
2
3 This document describes how event hooks work in MediaWiki; how to add hooks for
4 an event; and how to run hooks for an event.
5
6 ==Glossary==
7
8 event
9 Something that happens with the wiki. For example: a user logs in. A wiki
10 page is saved. A wiki page is deleted. Often there are two events
11 associated with a single action: one before the code is run to make the
12 event happen, and one after. Each event has a name, preferably in
13 CamelCase. For example, 'UserLogin', 'PageContentSave',
14 'PageContentSaveComplete', 'ArticleDelete'.
15
16 hook
17 A clump of code and data that should be run when an event happens. This can
18 be either a function and a chunk of data, or an object and a method.
19
20 hook function
21 The function part of a hook.
22
23 ==Rationale==
24
25 Hooks allow us to decouple optionally-run code from code that is run for
26 everyone. It allows MediaWiki hackers, third-party developers and local
27 administrators to define code that will be run at certain points in the mainline
28 code, and to modify the data run by that mainline code. Hooks can keep mainline
29 code simple, and make it easier to write extensions. Hooks are a principled
30 alternative to local patches.
31
32 Consider, for example, two options in MediaWiki. One reverses the order of a
33 title before displaying the article; the other converts the title to all
34 uppercase letters. Currently, in MediaWiki code, we would handle this as follows
35 (note: not real code, here):
36
37 function showAnArticle( $article ) {
38 global $wgReverseTitle, $wgCapitalizeTitle;
39
40 if ( $wgReverseTitle ) {
41 wfReverseTitle( $article );
42 }
43
44 if ( $wgCapitalizeTitle ) {
45 wfCapitalizeTitle( $article );
46 }
47
48 # code to actually show the article goes here
49 }
50
51 An extension writer, or a local admin, will often add custom code to the
52 function -- with or without a global variable. For example, someone wanting
53 email notification when an article is shown may add:
54
55 function showAnArticle( $article ) {
56 global $wgReverseTitle, $wgCapitalizeTitle, $wgNotifyArticle;
57
58 if ( $wgReverseTitle ) {
59 wfReverseTitle( $article );
60 }
61
62 if ( $wgCapitalizeTitle ) {
63 wfCapitalizeTitle( $article );
64 }
65
66 # code to actually show the article goes here
67
68 if ( $wgNotifyArticle ) {
69 wfNotifyArticleShow( $article );
70 }
71 }
72
73 Using a hook-running strategy, we can avoid having all this option-specific
74 stuff in our mainline code. Using hooks, the function becomes:
75
76 function showAnArticle( $article ) {
77 if ( Hooks::run( 'ArticleShow', [ &$article ] ) ) {
78 # code to actually show the article goes here
79
80 Hooks::run( 'ArticleShowComplete', [ &$article ] );
81 }
82 }
83
84 We've cleaned up the code here by removing clumps of weird, infrequently used
85 code and moving them off somewhere else. It's much easier for someone working
86 with this code to see what's _really_ going on, and make changes or fix bugs.
87
88 In addition, we can take all the code that deals with the little-used
89 title-reversing options (say) and put it in one place. Instead of having little
90 title-reversing if-blocks spread all over the codebase in showAnArticle,
91 deleteAnArticle, exportArticle, etc., we can concentrate it all in an extension
92 file:
93
94 function reverseArticleTitle( $article ) {
95 # ...
96 }
97
98 function reverseForExport( $article ) {
99 # ...
100 }
101
102 The setup function for the extension just has to add its hook functions to the
103 appropriate events:
104
105 setupTitleReversingExtension() {
106 global $wgHooks;
107
108 $wgHooks['ArticleShow'][] = 'reverseArticleTitle';
109 $wgHooks['ArticleDelete'][] = 'reverseArticleTitle';
110 $wgHooks['ArticleExport'][] = 'reverseForExport';
111 }
112
113 Having all this code related to the title-reversion option in one place means
114 that it's easier to read and understand; you don't have to do a grep-find to see
115 where the $wgReverseTitle variable is used, say.
116
117 If the code is well enough isolated, it can even be excluded when not used --
118 making for some slight savings in memory and load-up performance at runtime.
119 Admins who want to have all the reversed titles can add:
120
121 require_once 'extensions/ReverseTitle.php';
122
123 ...to their LocalSettings.php file; those of us who don't want or need it can
124 just leave it out.
125
126 The extensions don't even have to be shipped with MediaWiki; they could be
127 provided by a third-party developer or written by the admin him/herself.
128
129 ==Writing hooks==
130
131 A hook is a chunk of code run at some particular event. It consists of:
132
133 * a function with some optional accompanying data, or
134 * an object with a method and some optional accompanying data.
135
136 Hooks are registered by adding them to the global $wgHooks array for a given
137 event. All the following are valid ways to define hooks:
138
139 $wgHooks['EventName'][] = 'someFunction'; # function, no data
140 $wgHooks['EventName'][] = [ 'someFunction', $someData ];
141 $wgHooks['EventName'][] = [ 'someFunction' ]; # weird, but OK
142
143 $wgHooks['EventName'][] = $object; # object only
144 $wgHooks['EventName'][] = [ $object, 'someMethod' ];
145 $wgHooks['EventName'][] = [ $object, 'someMethod', $someData ];
146 $wgHooks['EventName'][] = [ $object ]; # weird but OK
147
148 When an event occurs, the function (or object method) will be called with the
149 optional data provided as well as event-specific parameters. The above examples
150 would result in the following code being executed when 'EventName' happened:
151
152 # function, no data
153 someFunction( $param1, $param2 )
154 # function with data
155 someFunction( $someData, $param1, $param2 )
156
157 # object only
158 $object->onEventName( $param1, $param2 )
159 # object with method
160 $object->someMethod( $param1, $param2 )
161 # object with method and data
162 $object->someMethod( $someData, $param1, $param2 )
163
164 Note that when an object is the hook, and there's no specified method, the
165 default method called is 'onEventName'. For different events this would be
166 different: 'onArticleSave', 'onUserLogin', etc.
167
168 The extra data is useful if we want to use the same function or object for
169 different purposes. For example:
170
171 $wgHooks['PageContentSaveComplete'][] = [ 'ircNotify', 'TimStarling' ];
172 $wgHooks['PageContentSaveComplete'][] = [ 'ircNotify', 'brion' ];
173
174 This code would result in ircNotify being run twice when an article is saved:
175 once for 'TimStarling', and once for 'brion'.
176
177 Hooks can return three possible values:
178
179 * No return value (or null): the hook has operated successfully. Previously,
180 true was required. This is the default since MediaWiki 1.23.
181 * "some string": an error occurred; processing should stop and the error
182 should be shown to the user
183 * false: the hook has successfully done the work necessary and the calling
184 function should skip
185
186 The last result would be for cases where the hook function replaces the main
187 functionality. For example, if you wanted to authenticate users to a custom
188 system (LDAP, another PHP program, whatever), you could do:
189
190 $wgHooks['UserLogin'][] = [ 'ldapLogin', $ldapServer ];
191
192 function ldapLogin( $username, $password ) {
193 # log user into LDAP
194 return false;
195 }
196
197 Returning false makes less sense for events where the action is complete, and
198 will normally be ignored.
199
200 Note that none of the examples made use of create_function() as a way to
201 attach a function to a hook. This is known to cause problems (notably with
202 Special:Version), and should be avoided when at all possible.
203
204 ==Using hooks==
205
206 A calling function or method uses the Hooks::run() function to run the hooks
207 related to a particular event, like so:
208
209 class Article {
210 # ...
211 function protect() {
212 global $wgUser;
213
214 // Avoid PHP 7.1 warning from passing $this by reference
215 $article = $this;
216
217 if ( Hooks::run( 'ArticleProtect', [ &$article, &$wgUser ] ) ) {
218 # protect the article
219 Hooks::run( 'ArticleProtectComplete', [ &$article, &$wgUser ] );
220 }
221 }
222 }
223
224 Hooks::run() returns true if the calling function should continue processing
225 (the hooks ran OK, or there are no hooks to run), or false if it shouldn't (an
226 error occurred, or one of the hooks handled the action already). Checking the
227 return value matters more for "before" hooks than for "complete" hooks.
228
229 Note that hook parameters are passed in an array; this is a necessary
230 inconvenience to make it possible to pass reference values (which can be changed)
231 by the hook callback.
232
233 ==Events and parameters==
234
235 This is a list of known events and parameters; please add to it if you're going
236 to add events to the MediaWiki code.
237
238 'AbortAutoblock': Return false to cancel an autoblock.
239 $autoblockip: The IP going to be autoblocked.
240 &$block: The block from which the autoblock is coming.
241
242 'AbortDiffCache': Can be used to cancel the caching of a diff.
243 &$diffEngine: DifferenceEngine object
244
245 'AbortEmailNotification': Can be used to cancel email notifications for an edit.
246 $editor: The User who made the change.
247 $title: The Title of the page that was edited.
248 $rc: The current RecentChange object.
249
250 'AbortTalkPageEmailNotification': Return false to cancel talk page email
251 notification
252 $targetUser: the user whom to send talk page email notification
253 $title: the page title
254
255 'ActionBeforeFormDisplay': Before executing the HTMLForm object.
256 $name: name of the action
257 &$form: HTMLForm object
258 $article: Article object
259
260 'ActionModifyFormFields': Before creating an HTMLForm object for a page action;
261 Allows to change the fields on the form that will be generated.
262 $name: name of the action
263 &$fields: HTMLForm descriptor array
264 $article: Article object
265
266 'AddNewAccount': DEPRECATED since 1.27! Use LocalUserCreated.
267 After a user account is created.
268 $user: the User object that was created. (Parameter added in 1.7)
269 $byEmail: true when account was created "by email" (added in 1.12)
270
271 'AfterBuildFeedLinks': Executed in OutputPage.php after all feed links (atom,
272 rss,...) are created. Can be used to omit specific feeds from being outputted.
273 You must not use this hook to add feeds, use OutputPage::addFeedLink() instead.
274 &$feedLinks: Array of created feed links
275
276 'AfterFinalPageOutput': Nearly at the end of OutputPage::output() but
277 before OutputPage::sendCacheControl() and final ob_end_flush() which
278 will send the buffered output to the client. This allows for last-minute
279 modification of the output within the buffer by using ob_get_clean().
280 $output: The OutputPage object where output() was called
281
282 'AfterImportPage': When a page import is completed.
283 $title: Title under which the revisions were imported
284 $foreignTitle: ForeignTitle object based on data provided by the XML file
285 $revCount: Number of revisions in the XML file
286 $sRevCount: Number of successfully imported revisions
287 $pageInfo: associative array of page information
288
289 'AfterParserFetchFileAndTitle': After an image gallery is formed by Parser,
290 just before adding its HTML to parser output.
291 $parser: Parser object that called the hook
292 $ig: Gallery, an object of one of the gallery classes (inheriting from
293 ImageGalleryBase)
294 &$html: HTML generated by the gallery
295
296 'AlternateEdit': Before checking if a user can edit a page and before showing
297 the edit form ( EditPage::edit() ). This is triggered on &action=edit.
298 $editPage: the EditPage object
299
300 'AlternateEditPreview': Before generating the preview of the page when editing
301 ( EditPage::getPreviewText() ).
302 Return false and set $previewHTML and $parserOutput to output custom page
303 preview HTML.
304 $editPage: the EditPage object
305 &$content: the Content object for the text field from the edit page
306 &$previewHTML: Text to be placed into the page for the preview
307 &$parserOutput: the ParserOutput object for the preview
308
309 'AlternateUserMailer': Called before mail is sent so that mail could be logged
310 (or something else) instead of using PEAR or PHP's mail(). Return false to skip
311 the regular method of sending mail. Return a string to return a php-mail-error
312 message containing the error. Returning true will continue with sending email
313 in the regular way.
314 $headers: Associative array of headers for the email
315 $to: MailAddress object or array
316 $from: From address
317 $subject: Subject of the email
318 $body: Body of the message
319
320 'AncientPagesQuery': Allow extensions to modify the query used by
321 Special:AncientPages.
322 &$tables: tables to join in the query
323 &$conds: conditions for the query
324 &$joinConds: join conditions for the query
325
326 'APIAfterExecute': After calling the execute() method of an API module. Use
327 this to extend core API modules.
328 &$module: Module object
329
330 'ApiBeforeMain': Before calling ApiMain's execute() method in api.php.
331 &$main: ApiMain object
332
333 'ApiCheckCanExecute': Called during ApiMain::checkCanExecute. Use to further
334 authenticate and authorize API clients before executing the module. Return
335 false and set a message to cancel the request.
336 $module: Module object
337 $user: Current user
338 &$message: API message to die with. Specific values accepted depend on the
339 MediaWiki version:
340 * 1.29+: IApiMessage, Message, string message key, or key+parameters array to
341 pass to ApiBase::dieWithError().
342 * 1.27+: IApiMessage, or a key or key+parameters in ApiBase::$messageMap.
343 * Earlier: A key or key+parameters in ApiBase::$messageMap.
344
345 'ApiDeprecationHelp': Add messages to the 'deprecation-help' warning generated
346 from ApiBase::addDeprecation().
347 &$msgs: Message[] Messages to include in the help. Multiple messages will be
348 joined with spaces.
349
350 'APIEditBeforeSave': DEPRECATED since 1.28! Use EditFilterMergedContent instead.
351 Before saving a page with api.php?action=edit, after
352 processing request parameters. Return false to let the request fail, returning
353 an error message or an <edit result="Failure"> tag if $resultArr was filled.
354 Unlike for example 'EditFilterMergedContent' this also being run on undo.
355 Since MediaWiki 1.25, 'EditFilterMergedContent' can also return error details
356 for the API and it's recommended to use it instead of this hook.
357 $editPage: the EditPage object
358 $text: the text passed to the API. Note that this includes only the single
359 section for section edit, and is not necessarily the final text in case of
360 automatically resolved edit conflicts.
361 &$resultArr: data in this array will be added to the API result
362
363 'ApiFeedContributions::feedItem': Called to convert the result of ContribsPager
364 into a FeedItem instance that ApiFeedContributions can consume. Implementors of
365 this hook may cancel the hook to signal that the item is not viewable in the
366 provided context.
367 $row: A row of data from ContribsPager. The set of data returned by
368 ContribsPager can be adjusted by handling the ContribsPager::reallyDoQuery
369 hook.
370 $context: An IContextSource implementation.
371 &$feedItem: Set this to a FeedItem instance if the callback can handle the
372 provided row. This is provided to the hook as a null, if it is non null then
373 another callback has already handled the hook.
374
375 'ApiFormatHighlight': Use to syntax-highlight API pretty-printed output. When
376 highlighting, add output to $context->getOutput() and return false.
377 $context: An IContextSource.
378 $text: Text to be highlighted.
379 $mime: MIME type of $text.
380 $format: API format code for $text.
381
382 'APIGetAllowedParams': Use this hook to modify a module's parameters.
383 &$module: ApiBase Module object
384 &$params: Array of parameters
385 $flags: int zero or OR-ed flags like ApiBase::GET_VALUES_FOR_HELP
386
387 'APIGetDescriptionMessages': Use this hook to modify a module's help message.
388 $module: ApiBase Module object
389 &$msg: Array of Message objects
390
391 'APIGetParamDescriptionMessages': Use this hook to modify a module's parameter
392 descriptions.
393 $module: ApiBase Module object
394 &$msg: Array of arrays of Message objects
395
396 'APIHelpModifyOutput': Use this hook to modify an API module's help output.
397 $module: ApiBase Module object
398 &$help: Array of HTML strings to be joined for the output.
399 $options: Array Options passed to ApiHelp::getHelp
400 &$tocData: Array If a TOC is being generated, this array has keys as anchors in
401 the page and values as for Linker::generateTOC().
402
403 'ApiMain::moduleManager': Called when ApiMain has finished initializing its
404 module manager. Can be used to conditionally register API modules.
405 $moduleManager: ApiModuleManager Module manager instance
406
407 'ApiMain::onException': Called by ApiMain::executeActionWithErrorHandling() when
408 an exception is thrown during API action execution.
409 $apiMain: Calling ApiMain instance.
410 $e: Exception object.
411
412 'ApiMakeParserOptions': Called from ApiParse and ApiExpandTemplates to allow
413 extensions to adjust the ParserOptions before parsing.
414 $options: ParserOptions object
415 $title: Title to be parsed
416 $params: Parameter array for the API module
417 $module: API module (which is also a ContextSource)
418 &$reset: Set to a ScopedCallback used to reset any hooks after the parse is done.
419 &$suppressCache: Set true if cache should be suppressed.
420
421 'ApiOpenSearchSuggest': Called when constructing the OpenSearch results. Hooks
422 can alter or append to the array.
423 &$results: array with integer keys to associative arrays. Keys in associative
424 array:
425 - title: Title object.
426 - redirect from: Title or null.
427 - extract: Description for this result.
428 - extract trimmed: If truthy, the extract will not be trimmed to
429 $wgOpenSearchDescriptionLength.
430 - image: Thumbnail for this result. Value is an array with subkeys 'source'
431 (url), 'width', 'height', 'alt', 'align'.
432 - url: Url for the given title.
433
434 'ApiOptions': Called by action=options before applying changes to user
435 preferences.
436 $apiModule: Calling ApiOptions object
437 $user: User object whose preferences are being changed
438 $changes: Associative array of preference name => value
439 $resetKinds: Array of strings specifying which options kinds to reset.
440 See User::resetOptions() and User::getOptionKinds() for possible
441 values.
442
443 'ApiParseMakeOutputPage': Called when preparing the OutputPage object for
444 ApiParse. This is mainly intended for calling OutputPage::addContentOverride()
445 or OutputPage::addContentOverrideCallback().
446 $module: ApiBase (which is also a ContextSource)
447 $output: OutputPage
448
449 'ApiQuery::moduleManager': Called when ApiQuery has finished initializing its
450 module manager. Can be used to conditionally register API query modules.
451 $moduleManager: ApiModuleManager Module manager instance
452
453 'APIQueryAfterExecute': After calling the execute() method of an
454 action=query submodule. Use this to extend core API modules.
455 &$module: Module object
456
457 'ApiQueryBaseAfterQuery': Called for (some) API query modules after the
458 database query has returned. An API query module wanting to use this hook
459 should see the ApiQueryBase::select() and ApiQueryBase::processRow()
460 documentation.
461 $module: ApiQueryBase module in question
462 $result: ResultWrapper|bool returned from the IDatabase::select()
463 &$hookData: array that was passed to the 'ApiQueryBaseBeforeQuery' hook and
464 will be passed to the 'ApiQueryBaseProcessRow' hook, intended for inter-hook
465 communication.
466
467 'ApiQueryBaseBeforeQuery': Called for (some) API query modules before a
468 database query is made. WARNING: It would be very easy to misuse this hook and
469 break the module! Any joins added *must* join on a unique key of the target
470 table unless you really know what you're doing. An API query module wanting to
471 use this hook should see the ApiQueryBase::select() and
472 ApiQueryBase::processRow() documentation.
473 $module: ApiQueryBase module in question
474 &$tables: array of tables to be queried
475 &$fields: array of columns to select
476 &$conds: array of WHERE conditionals for query
477 &$query_options: array of options for the database request
478 &$join_conds: join conditions for the tables
479 &$hookData: array that will be passed to the 'ApiQueryBaseAfterQuery' and
480 'ApiQueryBaseProcessRow' hooks, intended for inter-hook communication.
481
482 'ApiQueryBaseProcessRow': Called for (some) API query modules as each row of
483 the database result is processed. Return false to stop processing the result
484 set. An API query module wanting to use this hook should see the
485 ApiQueryBase::select() and ApiQueryBase::processRow() documentation.
486 $module: ApiQueryBase module in question
487 $row: stdClass Database result row
488 &$data: array to be included in the ApiResult.
489 &$hookData: array that was be passed to the 'ApiQueryBaseBeforeQuery' and
490 'ApiQueryBaseAfterQuery' hooks, intended for inter-hook communication.
491
492 'APIQueryGeneratorAfterExecute': After calling the executeGenerator() method of
493 an action=query submodule. Use this to extend core API modules.
494 &$module: Module object
495 &$resultPageSet: ApiPageSet object
496
497 'APIQueryInfoTokens': DEPRECATED since 1.24! Use ApiQueryTokensRegisterTypes
498 instead. Use this hook to add custom tokens to prop=info. Every token has an
499 action, which will be used in the intoken parameter and in the output
500 (actiontoken="..."), and a callback function which should return the token, or
501 false if the user isn't allowed to obtain it. The prototype of the callback
502 function is func($pageid, $title), where $pageid is the page ID of the page the
503 token is requested for and $title is the associated Title object. In the hook,
504 just add your callback to the $tokenFunctions array and return true (returning
505 false makes no sense).
506 &$tokenFunctions: [ action => callback ]
507
508 'APIQueryRecentChangesTokens': DEPRECATED since 1.24! Use
509 ApiQueryTokensRegisterTypes instead.
510 Use this hook to add custom tokens to list=recentchanges. Every token has an
511 action, which will be used in the rctoken parameter and in the output
512 (actiontoken="..."), and a callback function which should return the token, or
513 false if the user isn't allowed to obtain it. The prototype of the callback
514 function is func($pageid, $title, $rc), where $pageid is the page ID of the
515 page associated to the revision the token is requested for, $title the
516 associated Title object and $rc the associated RecentChange object. In the
517 hook, just add your callback to the $tokenFunctions array and return true
518 (returning false makes no sense).
519 &$tokenFunctions: [ action => callback ]
520
521 'APIQueryRevisionsTokens': DEPRECATED since 1.24! Use
522 ApiQueryTokensRegisterTypes instead.
523 Use this hook to add custom tokens to prop=revisions. Every token has an
524 action, which will be used in the rvtoken parameter and in the output
525 (actiontoken="..."), and a callback function which should return the token, or
526 false if the user isn't allowed to obtain it. The prototype of the callback
527 function is func($pageid, $title, $rev), where $pageid is the page ID of the
528 page associated to the revision the token is requested for, $title the
529 associated Title object and $rev the associated Revision object. In the hook,
530 just add your callback to the $tokenFunctions array and return true (returning
531 false makes no sense).
532 &$tokenFunctions: [ action => callback ]
533
534 'APIQuerySiteInfoGeneralInfo': Use this hook to add extra information to the
535 sites general information.
536 $module: the current ApiQuerySiteInfo module
537 &$results: array of results, add things here
538
539 'APIQuerySiteInfoStatisticsInfo': Use this hook to add extra information to the
540 sites statistics information.
541 &$results: array of results, add things here
542
543 'ApiQueryTokensRegisterTypes': Use this hook to add additional token types to
544 action=query&meta=tokens. Note that most modules will probably be able to use
545 the 'csrf' token instead of creating their own token types.
546 &$salts: [ type => salt to pass to User::getEditToken(), or array of salt
547 and key to pass to Session::getToken() ]
548
549 'APIQueryUsersTokens': DEPRECATED since 1.24! Use ApiQueryTokensRegisterTypes
550 instead.
551 Use this hook to add custom token to list=users. Every token has an action,
552 which will be used in the ustoken parameter and in the output
553 (actiontoken="..."), and a callback function which should return the token, or
554 false if the user isn't allowed to obtain it. The prototype of the callback
555 function is func($user) where $user is the User object. In the hook, just add
556 your callback to the $tokenFunctions array and return true (returning false
557 makes no sense).
558 &$tokenFunctions: [ action => callback ]
559
560 'ApiQueryWatchlistExtractOutputData': Extract row data for ApiQueryWatchlist.
561 $module: ApiQueryWatchlist instance
562 $watchedItem: WatchedItem instance
563 $recentChangeInfo: Array of recent change info data
564 &$vals: Associative array of data to be output for the row
565
566 'ApiQueryWatchlistPrepareWatchedItemQueryServiceOptions': Populate the options
567 to be passed from ApiQueryWatchlist to WatchedItemQueryService.
568 $module: ApiQueryWatchlist instance
569 $params: Array of parameters, as would be returned by $module->extractRequestParams()
570 &$options: Array of options for WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo()
571
572 'ApiRsdServiceApis': Add or remove APIs from the RSD services list. Each service
573 should have its own entry in the $apis array and have a unique name, passed as
574 key for the array that represents the service data. In this data array, the
575 key-value-pair identified by the apiLink key is required.
576 &$apis: array of services
577
578 'ApiTokensGetTokenTypes': DEPRECATED since 1.24! Use ApiQueryTokensRegisterTypes instead.
579 Use this hook to extend action=tokens with new token types.
580 &$tokenTypes: supported token types in format 'type' => callback function
581 used to retrieve this type of tokens.
582
583 'ApiValidatePassword': Called from ApiValidatePassword.
584 $module: ApiValidatePassword instance.
585 &$r: Result array.
586
587 'Article::MissingArticleConditions': Before fetching deletion & move log entries
588 to display a message of a non-existing page being deleted/moved, give extensions
589 a chance to hide their (unrelated) log entries.
590 &$conds: Array of query conditions (all of which have to be met; conditions will
591 AND in the final query)
592 $logTypes: Array of log types being queried
593
594 'ArticleAfterFetchContentObject': DEPRECATED since 1.32, use ArticleRevisionViewCustom
595 to control output. After fetching content of an article from the database.
596 &$article: the article (object) being loaded from the database
597 &$content: the content of the article, as a Content object
598
599 'ArticleConfirmDelete': Before writing the confirmation form for article
600 deletion.
601 $article: the article (object) being deleted
602 $output: the OutputPage object
603 &$reason: the reason (string) the article is being deleted
604
605 'ArticleContentOnDiff': Before showing the article content below a diff. Use
606 this to change the content in this area or how it is loaded.
607 $diffEngine: the DifferenceEngine
608 $output: the OutputPage object
609
610 'ArticleRevisionViewCustom': Allows custom rendering of an article's content.
611 Note that it is preferable to implement proper handing for a custom data type using
612 the ContentHandler facility.
613 $revision: content of the page, as a RevisionRecord object, or null if the revision
614 could not be loaded. May also be a fake that wraps content supplied by an extension.
615 $title: title of the page
616 $oldid: the requested revision id, or 0 for the currrent revision.
617 $output: a ParserOutput object
618
619 'ArticleContentViewCustom': DEPRECATED since 1.32, use ArticleRevisionViewCustom instead,
620 or provide an appropriate ContentHandler. Allows to output the text of the article in a
621 different format than wikitext.
622 $content: content of the page, as a Content object
623 $title: title of the page
624 $output: a ParserOutput object
625
626 'ArticleDelete': Before an article is deleted.
627 &$wikiPage: the WikiPage (object) being deleted
628 &$user: the user (object) deleting the article
629 &$reason: the reason (string) the article is being deleted
630 &$error: if the deletion was prohibited, the (raw HTML) error message to display
631 (added in 1.13)
632 &$status: Status object, modify this to throw an error. Overridden by $error
633 (added in 1.20)
634 $suppress: Whether this is a suppression deletion or not (added in 1.27)
635
636 'ArticleDeleteAfterSuccess': Output after an article has been deleted.
637 $title: Title of the article that has been deleted.
638 $outputPage: OutputPage that can be used to append the output.
639
640 'ArticleDeleteComplete': After an article is deleted.
641 &$wikiPage: the WikiPage that was deleted
642 &$user: the user that deleted the article
643 $reason: the reason the article was deleted
644 $id: id of the article that was deleted
645 $content: the Content of the deleted page (or null, when deleting a broken page)
646 $logEntry: the ManualLogEntry used to record the deletion
647 $archivedRevisionCount: the number of revisions archived during the deletion
648
649 'ArticleEditUpdateNewTalk': Before updating user_newtalk when a user talk page
650 was changed.
651 &$wikiPage: WikiPage (object) of the user talk page
652 $recipient: User (object) who's talk page was edited
653
654 'ArticleEditUpdates': When edit updates (mainly link tracking) are made when an
655 article has been changed.
656 &$wikiPage: the WikiPage (object)
657 &$editInfo: data holder that includes the parser output ($editInfo->output) for
658 that page after the change
659 $changed: bool for if the page was changed
660
661 'ArticleEditUpdatesDeleteFromRecentchanges': Before deleting old entries from
662 recentchanges table, return false to not delete old entries.
663 &$wikiPage: WikiPage (object) being modified
664
665 'ArticleFromTitle': when creating an article object from a title object using
666 Wiki::articleFromTitle().
667 &$title: Title (object) used to create the article object
668 &$article: Article (object) that will be returned
669 $context: IContextSource (object)
670
671 'ArticleMergeComplete': After merging to article using Special:Mergehistory.
672 $targetTitle: target title (object)
673 $destTitle: destination title (object)
674
675 'ArticlePageDataAfter': After loading data of an article from the database.
676 &$wikiPage: WikiPage (object) whose data were loaded
677 &$row: row (object) returned from the database server
678
679 'ArticlePageDataBefore': Before loading data of an article from the database.
680 &$wikiPage: WikiPage (object) that data will be loaded
681 &$fields: fields (array) to load from the database
682 &$tables: tables (array) to load from the database
683 &$joinConds: join conditions (array) to load from the database
684
685 'ArticlePrepareTextForEdit': Called when preparing text to be saved.
686 $wikiPage: the WikiPage being saved
687 $popts: parser options to be used for pre-save transformation
688
689 'ArticleProtect': Before an article is protected.
690 &$wikiPage: the WikiPage being protected
691 &$user: the user doing the protection
692 $protect: Set of restriction keys
693 $reason: Reason for protect
694
695 'ArticleProtectComplete': After an article is protected.
696 &$wikiPage: the WikiPage that was protected
697 &$user: the user who did the protection
698 $protect: Set of restriction keys
699 $reason: Reason for protect
700
701 'ArticlePurge': Before executing "&action=purge".
702 &$wikiPage: WikiPage (object) to purge
703
704 'ArticleRevisionUndeleted': After an article revision is restored.
705 &$title: the article title
706 $revision: the revision
707 $oldPageID: the page ID of the revision when archived (may be null)
708
709 'ArticleRevisionVisibilitySet': Called when changing visibility of one or more
710 revisions of an article.
711 $title: Title object of the article
712 $ids: Ids to set the visibility for
713 $visibilityChangeMap: Map of revision id to oldBits and newBits. This array can be
714 examined to determine exactly what visibility bits have changed for each
715 revision. This array is of the form
716 [id => ['oldBits' => $oldBits, 'newBits' => $newBits], ... ]
717
718 'ArticleRollbackComplete': After an article rollback is completed.
719 $wikiPage: the WikiPage that was edited
720 $user: the user who did the rollback
721 $revision: the revision the page was reverted back to
722 $current: the reverted revision
723
724 'ArticleShowPatrolFooter': Called at the beginning of Article#showPatrolFooter.
725 Extensions can use this to not show the [mark as patrolled] link in certain
726 circumstances.
727 $article: the Article object
728
729 'ArticleUndelete': When one or more revisions of an article are restored.
730 &$title: Title corresponding to the article restored
731 $create: Whether or not the restoration caused the page to be created (i.e. it
732 didn't exist before).
733 $comment: The comment associated with the undeletion.
734 $oldPageId: ID of page previously deleted (from archive table). This ID will be used
735 for the restored page.
736 $restoredPages: Set of page IDs that have revisions restored for this undelete,
737 with keys being page IDs and values are 'true'.
738
739 'ArticleUndeleteLogEntry': When a log entry is generated but not yet saved.
740 $pageArchive: the PageArchive object
741 &$logEntry: ManualLogEntry object
742 $user: User who is performing the log action
743
744 'ArticleUpdateBeforeRedirect': After a page is updated (usually on save), before
745 the user is redirected back to the page.
746 $article: the article
747 &$sectionanchor: The section anchor link (e.g. "#overview" )
748 &$extraq: Extra query parameters which can be added via hooked functions
749
750 'ArticleViewFooter': After showing the footer section of an ordinary page view
751 $article: Article object
752 $patrolFooterShown: boolean whether patrol footer is shown
753
754 'ArticleViewHeader': Control article output. Called before the parser cache is about
755 to be tried for article viewing.
756 &$article: the article
757 &$pcache: whether to try the parser cache or not
758 &$outputDone: whether the output for this page finished or not. Set to
759 a ParserOutput object to both indicate that the output is done and what
760 parser output was used.
761
762 'ArticleViewRedirect': Before setting "Redirected from ..." subtitle when a
763 redirect was followed.
764 &$article: target article (object)
765
766 'AuthChangeFormFields': After converting a field information array obtained
767 from a set of AuthenticationRequest classes into a form descriptor; hooks
768 can tweak the array to change how login etc. forms should look.
769 $requests: array of AuthenticationRequests the fields are created from
770 $fieldInfo: field information array (union of all
771 AuthenticationRequest::getFieldInfo() responses).
772 &$formDescriptor: HTMLForm descriptor. The special key 'weight' can be set
773 to change the order of the fields.
774 $action: one of the AuthManager::ACTION_* constants.
775
776 'AuthManagerLoginAuthenticateAudit': A login attempt either succeeded or failed
777 for a reason other than misconfiguration or session loss. No return data is
778 accepted; this hook is for auditing only.
779 $response: The MediaWiki\Auth\AuthenticationResponse in either a PASS or FAIL
780 state.
781 $user: The User object being authenticated against, or null if authentication
782 failed before getting that far.
783 $username: A guess at the user name being authenticated, or null if we can't
784 even determine that. When $user is not null, it can be in the form of
785 <username>@<more info> (e.g. for bot passwords).
786 $extraData: An array (string => string) with extra information, intended to be
787 added to log contexts. Fields it might include:
788 - appId: the application ID, only if the login was with a bot password
789
790 'AuthPluginAutoCreate': DEPRECATED since 1.27! Use the 'LocalUserCreated' hook
791 instead. Called when creating a local account for an user logged in from an
792 external authentication method.
793 $user: User object created locally
794
795 'AuthPluginSetup': DEPRECATED since 1.27! Extensions should be updated to use
796 AuthManager. Update or replace authentication plugin object ($wgAuth). Gives a
797 chance for an extension to set it programmatically to a variable class.
798 &$auth: the $wgAuth object, probably a stub
799
800 'AutopromoteCondition': Check autopromote condition for user.
801 $type: condition type
802 $args: arguments
803 $user: user
804 &$result: result of checking autopromote condition
805
806 'BacklinkCacheGetConditions': Allows to set conditions for query when links to
807 certain title are fetched.
808 $table: table name
809 $title: title of the page to which backlinks are sought
810 &$conds: query conditions
811
812 'BacklinkCacheGetPrefix': Allows to set prefix for a specific link table.
813 $table: table name
814 &$prefix: prefix
815
816 'BadImage': When checking against the bad image list. Change $bad and return
817 false to override. If an image is "bad", it is not rendered inline in wiki
818 pages or galleries in category pages.
819 $name: Image name being checked
820 &$bad: Whether or not the image is "bad"
821
822 'BaseTemplateAfterPortlet': After output of portlets, allow injecting
823 custom HTML after the section. Any uses of the hook need to handle escaping.
824 $template: BaseTemplate
825 $portlet: string portlet name
826 &$html: string
827
828 'BaseTemplateToolbox': Called by BaseTemplate when building the $toolbox array
829 and returning it for the skin to output. You can add items to the toolbox while
830 still letting the skin make final decisions on skin-specific markup conventions
831 using this hook.
832 &$sk: The BaseTemplate base skin template
833 &$toolbox: An array of toolbox items, see BaseTemplate::getToolbox and
834 BaseTemplate::makeListItem for details on the format of individual items
835 inside of this array.
836
837 'BeforeDisplayNoArticleText': Before displaying message key "noarticletext" or
838 "noarticletext-nopermission" at Article::showMissingArticle().
839 $article: article object
840
841 'BeforeHttpsRedirect': Prior to forcing HTTP->HTTPS redirect. Gives a chance to
842 override how the redirect is output by modifying, or by returning false, and
843 letting standard HTTP rendering take place.
844 ATTENTION: This hook is likely to be removed soon due to overall design of the
845 system.
846 $context: IContextSource object
847 &$redirect: string URL, modifiable
848
849 'BeforeInitialize': Before anything is initialized in
850 MediaWiki::performRequest().
851 &$title: Title being used for request
852 &$unused: null
853 &$output: OutputPage object
854 &$user: User
855 $request: WebRequest object
856 $mediaWiki: Mediawiki object
857
858 'BeforePageDisplay': Prior to outputting a page.
859 &$out: OutputPage object
860 &$skin: Skin object
861
862 'BeforePageRedirect': Prior to sending an HTTP redirect. Gives a chance to
863 override how the redirect is output by modifying, or by returning false and
864 taking over the output.
865 $out: OutputPage object
866 &$redirect: URL, modifiable
867 &$code: HTTP code (eg '301' or '302'), modifiable
868
869 'BeforeParserFetchFileAndTitle': Before an image is rendered by Parser.
870 $parser: Parser object
871 $nt: the image title
872 &$options: array of options to RepoGroup::findFile. If it contains 'broken'
873 as a key then the file will appear as a broken thumbnail.
874 &$descQuery: query string to add to thumbnail URL
875
876 'BeforeParserFetchTemplateAndtitle': Before a template is fetched by Parser.
877 $parser: Parser object
878 $title: title of the template
879 &$skip: skip this template and link it?
880 &$id: the id of the revision being parsed
881
882 'BeforeParserrenderImageGallery': Before an image gallery is rendered by Parser.
883 &$parser: Parser object
884 &$ig: ImageGallery object
885
886 'BeforeWelcomeCreation': Before the welcomecreation message is displayed to a
887 newly created user.
888 &$welcome_creation_msg: MediaWiki message name to display on the welcome screen
889 to a newly created user account.
890 &$injected_html: Any HTML to inject after the "logged in" message of a newly
891 created user account
892
893 'BitmapHandlerCheckImageArea': By BitmapHandler::normaliseParams, after all
894 normalizations have been performed, except for the $wgMaxImageArea check.
895 $image: File
896 &$params: Array of parameters
897 &$checkImageAreaHookResult: null, set to true or false to override the
898 $wgMaxImageArea check result.
899
900 'BitmapHandlerTransform': before a file is transformed, gives extension the
901 possibility to transform it themselves
902 $handler: BitmapHandler
903 $image: File
904 &$scalerParams: Array with scaler parameters
905 &$mto: null, set to a MediaTransformOutput
906
907 'BlockIp': Before an IP address or user is blocked.
908 &$block: the Block object about to be saved
909 &$user: the user _doing_ the block (not the one being blocked)
910 &$reason: if the hook is aborted, the error message to be returned in an array
911
912 'BlockIpComplete': After an IP address or user is blocked.
913 $block: the Block object that was saved
914 $user: the user who did the block (not the one being blocked)
915 $priorBlock: the Block object for the prior block or null if there was none
916
917 'BookInformation': Before information output on Special:Booksources.
918 $isbn: ISBN to show information for
919 $output: OutputPage object in use
920
921 'CanIPUseHTTPS': Determine whether the client at a given source IP is likely
922 to be able to access the wiki via HTTPS.
923 $ip: The IP address in human-readable form
924 &$canDo: This reference should be set to false if the client may not be able
925 to use HTTPS
926
927 'CanonicalNamespaces': For extensions adding their own namespaces or altering
928 the defaults.
929 Note that if you need to specify namespace protection or content model for
930 a namespace that is added in a CanonicalNamespaces hook handler, you
931 should do so by altering $wgNamespaceProtection and
932 $wgNamespaceContentModels outside the handler, in top-level scope. The
933 point at which the CanonicalNamespaces hook fires is too late for altering
934 these variables. This applies even if the namespace addition is
935 conditional; it is permissible to declare a content model and protection
936 for a namespace and then decline to actually register it.
937 &$namespaces: Array of namespace numbers with corresponding canonical names
938
939 'CategoryAfterPageAdded': After a page is added to a category.
940 $category: Category that page was added to
941 $wikiPage: WikiPage that was added
942
943 'CategoryAfterPageRemoved': After a page is removed from a category.
944 $category: Category that page was removed from
945 $wikiPage: WikiPage that was removed
946 $id: the page ID (original ID in case of page deletions)
947
948 'CategoryPageView': Before viewing a categorypage in CategoryPage::view.
949 &$catpage: CategoryPage instance
950
951 'CategoryViewer::doCategoryQuery': After querying for pages to be displayed
952 in a Category page. Gives extensions the opportunity to batch load any
953 related data about the pages.
954 $type: The category type. Either 'page', 'file' or 'subcat'
955 $res: Query result from Wikimedia\Rdbms\IDatabase::select()
956
957 'CategoryViewer::generateLink': Before generating an output link allow
958 extensions opportunity to generate a more specific or relevant link.
959 $type: The category type. Either 'page', 'img' or 'subcat'
960 $title: Title object for the categorized page
961 $html: Requested html content of anchor
962 &$link: Returned value. When set to a non-null value by a hook subscriber
963 this value will be used as the anchor instead of Linker::link
964
965 'ChangeAuthenticationDataAudit': Called when user changes his password.
966 No return data is accepted; this hook is for auditing only.
967 $req: AuthenticationRequest object describing the change (and target user)
968 $status: StatusValue with the result of the action
969
970 'ChangePasswordForm': DEPRECATED since 1.27! Use AuthChangeFormFields or
971 security levels. For extensions that need to add a field to the ChangePassword
972 form via the Preferences form.
973 &$extraFields: An array of arrays that hold fields like would be passed to the
974 pretty function.
975
976 'ChangesListInitRows': Batch process change list rows prior to rendering.
977 $changesList: ChangesList instance
978 $rows: The data that will be rendered. May be a ResultWrapper instance or
979 an array.
980
981 'ChangesListInsertArticleLink': Override or augment link to article in RC list.
982 &$changesList: ChangesList instance.
983 &$articlelink: HTML of link to article (already filled-in).
984 &$s: HTML of row that is being constructed.
985 &$rc: RecentChange instance.
986 $unpatrolled: Whether or not we are showing unpatrolled changes.
987 $watched: Whether or not the change is watched by the user.
988
989 'ChangesListSpecialPageQuery': Called when building SQL query on pages
990 inheriting from ChangesListSpecialPage (in core: RecentChanges,
991 RecentChangesLinked and Watchlist).
992 Do not use this to implement individual filters if they are compatible with the
993 ChangesListFilter and ChangesListFilterGroup structure.
994 Instead, use sub-classes of those classes, in conjunction with the
995 ChangesListSpecialPageStructuredFilters hook.
996 This hook can be used to implement filters that do not implement that structure,
997 or custom behavior that is not an individual filter.
998 $name: name of the special page, e.g. 'Watchlist'
999 &$tables: array of tables to be queried
1000 &$fields: array of columns to select
1001 &$conds: array of WHERE conditionals for query
1002 &$query_options: array of options for the database request
1003 &$join_conds: join conditions for the tables
1004 $opts: FormOptions for this request
1005
1006 'ChangesListSpecialPageStructuredFilters': Called to allow extensions to register
1007 filters for pages inheriting from ChangesListSpecialPage (in core: RecentChanges,
1008 RecentChangesLinked, and Watchlist). Generally, you will want to construct
1009 new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects.
1010 When constructing them, you specify which group they belong to. You can reuse
1011 existing groups (accessed through $special->getFilterGroup), or create your own
1012 (ChangesListBooleanFilterGroup or ChangesListStringOptionsFilterGroup).
1013 If you create new groups, you must register them with $special->registerFilterGroup.
1014 Note that this is called regardless of whether the user is currently using
1015 the new (structured) or old (unstructured) filter UI. If you want your boolean
1016 filter to show on both the new and old UI, specify all the supported fields.
1017 These include showHide, label, and description.
1018 See the constructor of each ChangesList* class for documentation of supported
1019 fields.
1020 $special: ChangesListSpecialPage instance
1021
1022 'ChangeTagAfterDelete': Called after a change tag has been deleted (that is,
1023 removed from all revisions and log entries to which it was applied). This gives
1024 extensions a chance to take it off their books.
1025 $tag: name of the tag
1026 &$status: Status object. Add warnings to this as required. There is no point
1027 setting errors, as the deletion has already been partly carried out by this
1028 point.
1029
1030 'ChangeTagCanCreate': Tell whether a change tag should be able to be created
1031 from the UI (Special:Tags) or via the API. You could use this hook if you want
1032 to reserve a specific "namespace" of tags, or something similar.
1033 $tag: name of the tag
1034 $user: user initiating the action
1035 &$status: Status object. Add your errors using `$status->fatal()` or warnings
1036 using `$status->warning()`. Errors and warnings will be relayed to the user.
1037 If you set an error, the user will be unable to create the tag.
1038
1039 'ChangeTagCanDelete': Tell whether a change tag should be able to be
1040 deleted from the UI (Special:Tags) or via the API. The default is that tags
1041 defined using the ListDefinedTags hook are not allowed to be deleted unless
1042 specifically allowed. If you wish to allow deletion of the tag, set
1043 `$status = Status::newGood()` to allow deletion, and then `return false` from
1044 the hook function. Ensure you consume the 'ChangeTagAfterDelete' hook to carry
1045 out custom deletion actions.
1046 $tag: name of the tag
1047 $user: user initiating the action
1048 &$status: Status object. See above.
1049
1050 'ChangeTagsListActive': Allows you to nominate which of the tags your extension
1051 uses are in active use.
1052 &$tags: list of all active tags. Append to this array.
1053
1054 'ChangeTagsAfterUpdateTags': Called after tags have been updated with the
1055 ChangeTags::updateTags function. Params:
1056 $addedTags: tags effectively added in the update
1057 $removedTags: tags effectively removed in the update
1058 $prevTags: tags that were present prior to the update
1059 $rc_id: recentchanges table id
1060 $rev_id: revision table id
1061 $log_id: logging table id
1062 $params: tag params
1063 $rc: RecentChange being tagged when the tagging accompanies the action, or null
1064 $user: User who performed the tagging when the tagging is subsequent to the
1065 action, or null
1066
1067 'ChangeTagsAllowedAdd': Called when checking if a user can add tags to a change.
1068 &$allowedTags: List of all the tags the user is allowed to add. Any tags the
1069 user wants to add ($addTags) that are not in this array will cause it to fail.
1070 You may add or remove tags to this array as required.
1071 $addTags: List of tags user intends to add.
1072 $user: User who is adding the tags.
1073
1074 'ChangeUserGroups': Called before user groups are changed.
1075 $performer: The User who will perform the change
1076 $user: The User whose groups will be changed
1077 &$add: The groups that will be added
1078 &$remove: The groups that will be removed
1079
1080 'Collation::factory': Called if $wgCategoryCollation is an unknown collation.
1081 $collationName: Name of the collation in question
1082 &$collationObject: Null. Replace with a subclass of the Collation class that
1083 implements the collation given in $collationName.
1084
1085 'ConfirmEmailComplete': Called after a user's email has been confirmed
1086 successfully.
1087 $user: user (object) whose email is being confirmed
1088
1089 'ContentAlterParserOutput': Modify parser output for a given content object.
1090 Called by Content::getParserOutput after parsing has finished. Can be used
1091 for changes that depend on the result of the parsing but have to be done
1092 before LinksUpdate is called (such as adding tracking categories based on
1093 the rendered HTML).
1094 $content: The Content to render
1095 $title: Title of the page, as context
1096 $parserOutput: ParserOutput to manipulate
1097
1098 'ContentGetParserOutput': Customize parser output for a given content object,
1099 called by AbstractContent::getParserOutput. May be used to override the normal
1100 model-specific rendering of page content.
1101 $content: The Content to render
1102 $title: Title of the page, as context
1103 $revId: The revision ID, as context
1104 $options: ParserOptions for rendering. To avoid confusing the parser cache,
1105 the output can only depend on parameters provided to this hook function, not
1106 on global state.
1107 $generateHtml: boolean, indicating whether full HTML should be generated. If
1108 false, generation of HTML may be skipped, but other information should still
1109 be present in the ParserOutput object.
1110 &$output: ParserOutput, to manipulate or replace
1111
1112 'ContentHandlerDefaultModelFor': Called when the default content model is
1113 determined for a given title. May be used to assign a different model for that
1114 title.
1115 $title: the Title in question
1116 &$model: the model name. Use with CONTENT_MODEL_XXX constants.
1117
1118 'ContentHandlerForModelID': Called when a ContentHandler is requested for
1119 a given content model name, but no entry for that model exists in
1120 $wgContentHandlers.
1121 Note: if your extension implements additional models via this hook, please
1122 use GetContentModels hook to make them known to core.
1123 $modeName: the requested content model name
1124 &$handler: set this to a ContentHandler object, if desired.
1125
1126 'ContentModelCanBeUsedOn': Called to determine whether that content model can
1127 be used on a given page. This is especially useful to prevent some content
1128 models to be used in some special location.
1129 $contentModel: ID of the content model in question
1130 $title: the Title in question.
1131 &$ok: Output parameter, whether it is OK to use $contentModel on $title.
1132 Handler functions that modify $ok should generally return false to prevent
1133 further hooks from further modifying $ok.
1134
1135 'ContribsPager::getQueryInfo': Before the contributions query is about to run
1136 &$pager: Pager object for contributions
1137 &$queryInfo: The query for the contribs Pager
1138
1139 'ContribsPager::reallyDoQuery': Called before really executing the query for My
1140 Contributions
1141 &$data: an array of results of all contribs queries
1142 $pager: The ContribsPager object hooked into
1143 $offset: Index offset, inclusive
1144 $limit: Exact query limit
1145 $descending: Query direction, false for ascending, true for descending
1146
1147 'ContributionsLineEnding': Called before a contributions HTML line is finished
1148 $page: SpecialPage object for contributions
1149 &$ret: the HTML line
1150 $row: the DB row for this line
1151 &$classes: the classes to add to the surrounding <li>
1152 &$attribs: associative array of other HTML attributes for the <li> element.
1153 Currently only data attributes reserved to MediaWiki are allowed
1154 (see Sanitizer::isReservedDataAttribute).
1155
1156 'ContributionsToolLinks': Change tool links above Special:Contributions
1157 $id: User identifier
1158 $title: User page title
1159 &$tools: Array of tool links
1160 $specialPage: SpecialPage instance for context and services. Can be either
1161 SpecialContributions or DeletedContributionsPage. Extensions should type
1162 hint against a generic SpecialPage though.
1163
1164 'ConvertContent': Called by AbstractContent::convert when a conversion to
1165 another content model is requested.
1166 Handler functions that modify $result should generally return false to disable
1167 further attempts at conversion.
1168 $content: The Content object to be converted.
1169 $toModel: The ID of the content model to convert to.
1170 $lossy: boolean indicating whether lossy conversion is allowed.
1171 &$result: Output parameter, in case the handler function wants to provide a
1172 converted Content object. Note that $result->getContentModel() must return
1173 $toModel.
1174
1175 'ContentSecurityPolicyDefaultSource': Modify the allowed CSP load sources. This
1176 affects all directives except for the script directive. If you want to add a
1177 script source, see ContentSecurityPolicyScriptSource hook.
1178 &$defaultSrc: Array of Content-Security-Policy allowed sources
1179 $policyConfig: Current configuration for the Content-Security-Policy header
1180 $mode: ContentSecurityPolicy::REPORT_ONLY_MODE or
1181 ContentSecurityPolicy::FULL_MODE depending on type of header
1182
1183 'ContentSecurityPolicyDirectives': Modify the content security policy
1184 directives. Use this only if ContentSecurityPolicyDefaultSource and
1185 ContentSecurityPolicyScriptSource do not meet your needs.
1186 &$directives: Array of CSP directives
1187 $policyConfig: Current configuration for the CSP header
1188 $mode: ContentSecurityPolicy::REPORT_ONLY_MODE or
1189 ContentSecurityPolicy::FULL_MODE depending on type of header
1190
1191 'ContentSecurityPolicyScriptSource': Modify the allowed CSP script sources.
1192 Note that you also have to use ContentSecurityPolicyDefaultSource if you
1193 want non-script sources to be loaded from
1194 whatever you add.
1195 &$scriptSrc: Array of CSP directives
1196 $policyConfig: Current configuration for the CSP header
1197 $mode: ContentSecurityPolicy::REPORT_ONLY_MODE or
1198 ContentSecurityPolicy::FULL_MODE depending on type of header
1199
1200 'CustomEditor': When invoking the page editor
1201 Return true to allow the normal editor to be used, or false if implementing
1202 a custom editor, e.g. for a special namespace, etc.
1203 $article: Article being edited
1204 $user: User performing the edit
1205
1206 'DatabaseOraclePostInit': Called after initialising an Oracle database
1207 $db: the DatabaseOracle object
1208
1209 'DeletedContribsPager::reallyDoQuery': Called before really executing the query
1210 for Special:DeletedContributions
1211 Similar to ContribsPager::reallyDoQuery
1212 &$data: an array of results of all contribs queries
1213 $pager: The DeletedContribsPager object hooked into
1214 $offset: Index offset, inclusive
1215 $limit: Exact query limit
1216 $descending: Query direction, false for ascending, true for descending
1217
1218 'DeletedContributionsLineEnding': Called before a DeletedContributions HTML line
1219 is finished.
1220 Similar to ContributionsLineEnding
1221 $page: SpecialPage object for DeletedContributions
1222 &$ret: the HTML line
1223 $row: the DB row for this line
1224 &$classes: the classes to add to the surrounding <li>
1225 &$attribs: associative array of other HTML attributes for the <li> element.
1226 Currently only data attributes reserved to MediaWiki are allowed
1227 (see Sanitizer::isReservedDataAttribute).
1228
1229 'DeleteUnknownPreferences': Called by the cleanupPreferences.php maintenance
1230 script to build a WHERE clause with which to delete preferences that are not
1231 known about. This hook is used by extensions that have dynamically-named
1232 preferences that should not be deleted in the usual cleanup process. For
1233 example, the Gadgets extension creates preferences prefixed with 'gadget-', and
1234 so anything with that prefix is excluded from the deletion.
1235 &where: An array that will be passed as the $cond parameter to
1236 IDatabase::select() to determine what will be deleted from the user_properties
1237 table.
1238 $db: The IDatabase object, useful for accessing $db->buildLike() etc.
1239
1240 'DifferenceEngineAfterLoadNewText': called in DifferenceEngine::loadNewText()
1241 after the new revision's content has been loaded into the class member variable
1242 $differenceEngine->mNewContent but before returning true from this function.
1243 $differenceEngine: DifferenceEngine object
1244
1245 'DifferenceEngineLoadTextAfterNewContentIsLoaded': called in
1246 DifferenceEngine::loadText() after the new revision's content has been loaded
1247 into the class member variable $differenceEngine->mNewContent but before
1248 checking if the variable's value is null.
1249 This hook can be used to inject content into said class member variable.
1250 $differenceEngine: DifferenceEngine object
1251
1252 'DifferenceEngineMarkPatrolledLink': Allows extensions to change the "mark as
1253 patrolled" link which is shown both on the diff header as well as on the bottom
1254 of a page, usually wrapped in a span element which has class="patrollink".
1255 $differenceEngine: DifferenceEngine object
1256 &$markAsPatrolledLink: The "mark as patrolled" link HTML (string)
1257 $rcid: Recent change ID (rc_id) for this change (int)
1258
1259 'DifferenceEngineMarkPatrolledRCID': Allows extensions to possibly change the
1260 rcid parameter. For example the rcid might be set to zero due to the user being
1261 the same as the performer of the change but an extension might still want to
1262 show it under certain conditions.
1263 &$rcid: rc_id (int) of the change or 0
1264 $differenceEngine: DifferenceEngine object
1265 $change: RecentChange object
1266 $user: User object representing the current user
1267
1268 'DifferenceEngineNewHeader': Allows extensions to change the $newHeader
1269 variable, which contains information about the new revision, such as the
1270 revision's author, whether the revision was marked as a minor edit or not, etc.
1271 $differenceEngine: DifferenceEngine object
1272 &$newHeader: The string containing the various #mw-diff-otitle[1-5] divs, which
1273 include things like revision author info, revision comment, RevisionDelete
1274 link and more
1275 $formattedRevisionTools: Array containing revision tools, some of which may have
1276 been injected with the DiffRevisionTools hook
1277 $nextlink: String containing the link to the next revision (if any); also
1278 included in $newHeader
1279 $rollback: Rollback link (string) to roll this revision back to the previous
1280 one, if any
1281 $newminor: String indicating if the new revision was marked as a minor edit
1282 $diffOnly: Boolean parameter passed to DifferenceEngine#showDiffPage, indicating
1283 whether we should show just the diff; passed in as a query string parameter to
1284 the various URLs constructed here (i.e. $nextlink)
1285 $rdel: RevisionDelete link for the new revision, if the current user is allowed
1286 to use the RevisionDelete feature
1287 $unhide: Boolean parameter indicating whether to show RevisionDeleted revisions
1288
1289 'DifferenceEngineOldHeader': Allows extensions to change the $oldHeader
1290 variable, which contains information about the old revision, such as the
1291 revision's author, whether the revision was marked as a minor edit or not, etc.
1292 $differenceEngine: DifferenceEngine object
1293 &$oldHeader: The string containing the various #mw-diff-otitle[1-5] divs, which
1294 include things like revision author info, revision comment, RevisionDelete
1295 link and more
1296 $prevlink: String containing the link to the previous revision (if any); also
1297 included in $oldHeader
1298 $oldminor: String indicating if the old revision was marked as a minor edit
1299 $diffOnly: Boolean parameter passed to DifferenceEngine#showDiffPage, indicating
1300 whether we should show just the diff; passed in as a query string parameter to
1301 the various URLs constructed here (i.e. $prevlink)
1302 $ldel: RevisionDelete link for the old revision, if the current user is allowed
1303 to use the RevisionDelete feature
1304 $unhide: Boolean parameter indicating whether to show RevisionDeleted revisions
1305
1306 'DifferenceEngineOldHeaderNoOldRev': Change the $oldHeader variable in cases
1307 when there is no old revision
1308 &$oldHeader: empty string by default
1309
1310 'DifferenceEngineRenderRevisionAddParserOutput': Allows extensions to change the
1311 parser output. Return false to not add parser output via OutputPage's
1312 addParserOutput method.
1313 $differenceEngine: DifferenceEngine object
1314 $out: OutputPage object
1315 $parserOutput: ParserOutput object
1316 $wikiPage: WikiPage object
1317
1318 'DifferenceEngineRenderRevisionShowFinalPatrolLink': An extension can hook into
1319 this hook point and return false to not show the final "mark as patrolled" link
1320 on the bottom of a page.
1321 This hook has no arguments.
1322
1323 'DifferenceEngineShowDiff': Allows extensions to affect the diff text which
1324 eventually gets sent to the OutputPage object.
1325 $differenceEngine: DifferenceEngine object
1326
1327 'DifferenceEngineShowEmptyOldContent': Allows extensions to change the diff
1328 table body (without header) in cases when there is no old revision or the old
1329 and new revisions are identical.
1330 $differenceEngine: DifferenceEngine object
1331
1332 'DifferenceEngineShowDiffPage': Add additional output via the available
1333 OutputPage object into the diff view
1334 $out: OutputPage object
1335
1336 'DifferenceEngineShowDiffPageMaybeShowMissingRevision': called in
1337 DifferenceEngine::showDiffPage() when revision data cannot be loaded.
1338 Return false in order to prevent displaying the missing revision message
1339 (i.e. to prevent DifferenceEngine::showMissingRevision() from being called).
1340 $differenceEngine: DifferenceEngine object
1341
1342 'DiffRevisionTools': Override or extend the revision tools available from the
1343 diff view, i.e. undo, etc.
1344 $newRev: Revision object of the "new" revision
1345 &$links: Array of HTML links
1346 $oldRev: Revision object of the "old" revision (may be null)
1347 $user: Current user object
1348
1349 'DiffViewHeader': Called before diff display
1350 $diff: DifferenceEngine object that's calling
1351 $oldRev: Revision object of the "old" revision (may be null/invalid)
1352 $newRev: Revision object of the "new" revision
1353
1354 'DisplayOldSubtitle': before creating subtitle when browsing old versions of
1355 an article
1356 &$article: article (object) being viewed
1357 &$oldid: oldid (int) being viewed
1358
1359 'EditFilter': Perform checks on an edit
1360 $editor: EditPage instance (object). The edit form (see includes/EditPage.php)
1361 $text: Contents of the edit box
1362 $section: Section being edited
1363 &$error: Error message to return
1364 $summary: Edit summary for page
1365
1366 'EditFilterMergedContent': Post-section-merge edit filter.
1367 This may be triggered by the EditPage or any other facility that modifies page
1368 content. Use the $status object to indicate whether the edit should be allowed,
1369 and to provide a reason for disallowing it. Return false to abort the edit, and
1370 true to continue. Returning true if $status->isOK() returns false means "don't
1371 save but continue user interaction", e.g. show the edit form.
1372 $status->apiHookResult can be set to an array to be returned by api.php
1373 action=edit. This is used to deliver captchas.
1374 $context: object implementing the IContextSource interface.
1375 $content: content of the edit box, as a Content object.
1376 $status: Status object to represent errors, etc.
1377 $summary: Edit summary for page
1378 $user: the User object representing the user whois performing the edit.
1379 $minoredit: whether the edit was marked as minor by the user.
1380
1381 'EditFormInitialText': Allows modifying the edit form when editing existing
1382 pages
1383 $editPage: EditPage object
1384
1385 'EditFormPreloadText': Allows population of the edit form when creating
1386 new pages
1387 &$text: Text to preload with
1388 &$title: Title object representing the page being created
1389
1390 'EditPage::attemptSave': Called before an article is
1391 saved, that is before WikiPage::doEditContent() is called
1392 $editpage_Obj: the current EditPage object
1393
1394 'EditPage::attemptSave:after': Called after an article save attempt
1395 $editpage_Obj: the current EditPage object
1396 $status: the resulting Status object
1397 $resultDetails: Result details array
1398
1399 'EditPage::importFormData': allow extensions to read additional data
1400 posted in the form
1401 Return value is ignored (should always return true)
1402 $editpage: EditPage instance
1403 $request: Webrequest
1404
1405 'EditPage::showEditForm:fields': allows injection of form field into edit form
1406 Return value is ignored (should always return true)
1407 &$editor: the EditPage instance for reference
1408 &$out: an OutputPage instance to write to
1409
1410 'EditPage::showEditForm:initial': before showing the edit form
1411 Return false to halt editing; you'll need to handle error messages, etc.
1412 yourself. Alternatively, modifying $error and returning true will cause the
1413 contents of $error to be echoed at the top of the edit form as wikitext.
1414 Return true without altering $error to allow the edit to proceed.
1415 &$editor: EditPage instance (object)
1416 &$out: an OutputPage instance to write to
1417
1418 'EditPage::showReadOnlyForm:initial': similar to EditPage::showEditForm:initial
1419 but for the read-only 'view source' variant of the edit form.
1420 Return value is ignored (should always return true)
1421 $editor: EditPage instance (object)
1422 &$out: an OutputPage instance to write to
1423
1424 'EditPage::showStandardInputs:options': allows injection of form fields into
1425 the editOptions area
1426 Return value is ignored (should always be true)
1427 $editor: EditPage instance (object)
1428 $out: an OutputPage instance to write to
1429 &$tabindex: HTML tabindex of the last edit check/button
1430
1431 'EditPageBeforeConflictDiff': allows modifying the EditPage object and output
1432 when there's an edit conflict. Return false to halt normal diff output; in
1433 this case you're responsible for computing and outputting the entire "conflict"
1434 part, i.e., the "difference between revisions" and "your text" headers and
1435 sections.
1436 &$editor: EditPage instance
1437 &$out: OutputPage instance
1438
1439 'EditPageBeforeEditButtons': Allows modifying the edit buttons below the
1440 textarea in the edit form.
1441 &$editpage: The current EditPage object
1442 &$buttons: Array of edit buttons "Save", "Preview", "Live", and "Diff"
1443 &$tabindex: HTML tabindex of the last edit check/button
1444
1445 'EditPageBeforeEditToolbar': Allow adding an edit toolbar above the textarea in
1446 the edit form.
1447 &$toolbar: The toolbar HTML, initially an empty `<div id="toolbar"></div>`
1448 Hook subscribers can return false to have no toolbar HTML be loaded.
1449
1450 'EditPageCopyrightWarning': Allow for site and per-namespace customization of
1451 contribution/copyright notice.
1452 $title: title of page being edited
1453 &$msg: localization message name, overridable. Default is either
1454 'copyrightwarning' or 'copyrightwarning2'.
1455
1456 'EditPageGetCheckboxesDefinition': Allows modifying the edit checkboxes
1457 below the textarea in the edit form.
1458 $editpage: The current EditPage object
1459 &$checkboxes: Array of checkbox definitions. See
1460 EditPage::getCheckboxesDefinition() for the format.
1461
1462 'EditPageGetDiffContent': Allow modifying the wikitext that will be used in
1463 "Show changes". Note that it is preferable to implement diff handling for
1464 different data types using the ContentHandler facility.
1465 $editPage: EditPage object
1466 &$newtext: wikitext that will be used as "your version"
1467
1468 'EditPageGetPreviewContent': Allow modifying the wikitext that will be
1469 previewed. Note that it is preferable to implement previews for different data
1470 types using the ContentHandler facility.
1471 $editPage: EditPage object
1472 &$content: Content object to be previewed (may be replaced by hook function)
1473
1474 'EditPageNoSuchSection': When a section edit request is given for an
1475 non-existent section
1476 &$editpage: The current EditPage object
1477 &$res: the HTML of the error text
1478
1479 'EditPageTosSummary': Give a chance for site and per-namespace customizations
1480 of terms of service summary link that might exist separately from the copyright
1481 notice.
1482 $title: title of page being edited
1483 &$msg: localization message name, overridable. Default is 'editpage-tos-summary'
1484
1485 'EmailConfirmed': When checking that the user's email address is "confirmed".
1486 This runs before the other checks, such as anonymity and the real check; return
1487 true to allow those checks to occur, and false if checking is done.
1488 &$user: User being checked
1489 &$confirmed: Whether or not the email address is confirmed
1490
1491 'EmailUser': Before sending email from one user to another.
1492 &$to: MailAddress object of receiving user
1493 &$from: MailAddress object of sending user
1494 &$subject: subject of the mail
1495 &$text: text of the mail
1496 &$error: Out-param for an error. Should be set to a Status object or boolean
1497 false.
1498
1499 'EmailUserCC': Before sending the copy of the email to the author.
1500 &$to: MailAddress object of receiving user
1501 &$from: MailAddress object of sending user
1502 &$subject: subject of the mail
1503 &$text: text of the mail
1504
1505 'EmailUserComplete': After sending email from one user to another.
1506 $to: MailAddress object of receiving user
1507 $from: MailAddress object of sending user
1508 $subject: subject of the mail
1509 $text: text of the mail
1510
1511 'EmailUserForm': After building the email user form object.
1512 &$form: HTMLForm object
1513
1514 'EmailUserPermissionsErrors': to retrieve permissions errors for emailing a
1515 user.
1516 $user: The user who is trying to email another user.
1517 $editToken: The user's edit token.
1518 &$hookErr: Out-param for the error. Passed as the parameters to
1519 OutputPage::showErrorPage.
1520
1521 'EnhancedChangesList::getLogText': to alter, remove or add to the links of a
1522 group of changes in EnhancedChangesList.
1523 Hook subscribers can return false to omit this line from recentchanges.
1524 $changesList: EnhancedChangesList object
1525 &$links: The links that were generated by EnhancedChangesList
1526 $block: The RecentChanges objects in that block
1527
1528 'EnhancedChangesListModifyLineData': to alter data used to build
1529 a grouped recent change inner line in EnhancedChangesList.
1530 Hook subscribers can return false to omit this line from recentchanges.
1531 $changesList: EnhancedChangesList object
1532 &$data: An array with all the components that will be joined in order to create
1533 the line
1534 $block: An array of RecentChange objects in that block
1535 $rc: The RecentChange object for this line
1536 &$classes: An array of classes to change
1537 &$attribs: associative array of other HTML attributes for the <tr> element.
1538 Currently only data attributes reserved to MediaWiki are allowed
1539 (see Sanitizer::isReservedDataAttribute).
1540
1541 'EnhancedChangesListModifyBlockLineData': to alter data used to build
1542 a non-grouped recent change line in EnhancedChangesList.
1543 $changesList: EnhancedChangesList object
1544 &$data: An array with all the components that will be joined in order to create
1545 the line
1546 $rc: The RecentChange object for this line
1547
1548 'ExemptFromAccountCreationThrottle': Exemption from the account creation
1549 throttle.
1550 $ip: The ip address of the user
1551
1552 'ExtensionTypes': Called when generating the extensions credits, use this to
1553 change the tables headers.
1554 &$extTypes: associative array of extensions types
1555
1556 'FetchChangesList': When fetching the ChangesList derivative for a particular
1557 user.
1558 $user: User the list is being fetched for
1559 &$skin: Skin object to be used with the list
1560 &$list: List object (defaults to NULL, change it to an object instance and
1561 return false override the list derivative used)
1562
1563 'FileDeleteComplete': When a file is deleted.
1564 &$file: reference to the deleted file
1565 &$oldimage: in case of the deletion of an old image, the name of the old file
1566 &$article: in case all revisions of the file are deleted a reference to the
1567 WikiFilePage associated with the file.
1568 &$user: user who performed the deletion
1569 &$reason: reason
1570
1571 'FileTransformed': When a file is transformed and moved into storage.
1572 $file: reference to the File object
1573 $thumb: the MediaTransformOutput object
1574 $tmpThumbPath: The temporary file system path of the transformed file
1575 $thumbPath: The permanent storage path of the transformed file
1576
1577 'FileUndeleteComplete': When a file is undeleted
1578 $title: title object to the file
1579 $fileVersions: array of undeleted versions. Empty if all versions were restored
1580 $user: user who performed the undeletion
1581 $reason: reason
1582
1583 'FileUpload': When a file upload occurs.
1584 $file: Image object representing the file that was uploaded
1585 $reupload: Boolean indicating if there was a previously another image there or
1586 not (since 1.17)
1587 $hasDescription: Boolean indicating that there was already a description page
1588 and a new one from the comment wasn't created (since 1.17)
1589
1590 'FormatAutocomments': When an autocomment is formatted by the Linker.
1591 &$comment: Reference to the accumulated comment. Initially null, when set the
1592 default code will be skipped.
1593 $pre: Boolean, true if there is text before this autocomment
1594 $auto: The extracted part of the parsed comment before the call to the hook.
1595 $post: Boolean, true if there is text after this autocomment
1596 $title: An optional title object used to links to sections. Can be null.
1597 $local: Boolean indicating whether section links should refer to local page.
1598 $wikiId: String containing the ID (as used by WikiMap) of the wiki from which the
1599 autocomment originated; null for the local wiki. Added in 1.26, should default
1600 to null in handler functions, for backwards compatibility.
1601
1602 'GalleryGetModes': Get list of classes that can render different modes of a
1603 gallery.
1604 &$modeArray: An associative array mapping mode names to classes that implement
1605 that mode. It is expected all registered classes are a subclass of
1606 ImageGalleryBase.
1607
1608 'GetAutoPromoteGroups': When determining which autopromote groups a user is
1609 entitled to be in.
1610 $user: user to promote.
1611 &$promote: groups that will be added.
1612
1613 'GetBlockedStatus': after loading blocking status of an user from the database
1614 &$user: user (object) being checked
1615
1616 'GetCacheVaryCookies': Get cookies that should vary cache options.
1617 $out: OutputPage object
1618 &$cookies: array of cookies name, add a value to it if you want to add a cookie
1619 that have to vary cache options
1620
1621 'GetCanonicalURL': Modify fully-qualified URLs used for IRC and e-mail
1622 notifications.
1623 &$title: Title object of page
1624 &$url: string value as output (out parameter, can modify)
1625 $query: query options as string passed to Title::getCanonicalURL()
1626
1627 'GetContentModels': Add content models to the list of available models.
1628 &$models: array containing current model list, as strings. Extensions should add to this list.
1629
1630 'GetDefaultSortkey': Override the default sortkey for a page.
1631 $title: Title object that we need to get a sortkey for
1632 &$sortkey: Sortkey to use.
1633
1634 'GetDifferenceEngine': Called when getting a new difference engine interface
1635 object. Can be used to decorate or replace the default difference engine.
1636 $context: IContextSource context to be used for diff
1637 $old: Revision ID to show and diff with
1638 $new: Either a revision ID or one of the strings 'cur', 'prev' or 'next'
1639 $refreshCache: If set, refreshes the diff cache
1640 $unhide: If set, allow viewing deleted revs
1641 &$differenceEngine: The difference engine object to be used for the diff
1642
1643 'GetDoubleUnderscoreIDs': Modify the list of behavior switch (double
1644 underscore) magic words. Called by MagicWord.
1645 &$doubleUnderscoreIDs: array of strings
1646
1647 'GetExtendedMetadata': Get extended file metadata for the API
1648 &$combinedMeta: Array of the form:
1649 'MetadataPropName' => [
1650 value' => prop value,
1651 'source' => 'name of hook'
1652 ].
1653 $file: File object of file in question
1654 $context: RequestContext (including language to use)
1655 $single: Only extract the current language; if false, the prop value should
1656 be in the metadata multi-language array format:
1657 mediawiki.org/wiki/Manual:File_metadata_handling#Multi-language_array_format
1658 &$maxCacheTime: how long the results can be cached
1659
1660 'GetFullURL': Modify fully-qualified URLs used in redirects/export/offsite data.
1661 &$title: Title object of page
1662 &$url: string value as output (out parameter, can modify)
1663 $query: query options as string passed to Title::getFullURL()
1664
1665 'GetHumanTimestamp': Pre-emptively override the human-readable timestamp
1666 generated by MWTimestamp::getHumanTimestamp(). Return false in this hook to use
1667 the custom output.
1668 &$output: string for the output timestamp
1669 $timestamp: MWTimestamp object of the current (user-adjusted) timestamp
1670 $relativeTo: MWTimestamp object of the relative (user-adjusted) timestamp
1671 $user: User whose preferences are being used to make timestamp
1672 $lang: Language that will be used to render the timestamp
1673
1674 'GetInternalURL': Modify fully-qualified URLs used for squid cache purging.
1675 &$title: Title object of page
1676 &$url: string value as output (out parameter, can modify)
1677 $query: query options as string passed to Title::getInternalURL()
1678
1679 'GetIP': modify the ip of the current user (called only once).
1680 &$ip: string holding the ip as determined so far
1681
1682 'GetLangPreferredVariant': Called in LanguageConverter#getPreferredVariant() to
1683 allow fetching the language variant code from cookies or other such
1684 alternative storage.
1685 &$req: language variant from the URL (string) or boolean false if no variant
1686 was specified in the URL; the value of this variable comes from
1687 LanguageConverter#getURLVariant()
1688
1689 'GetLinkColours': modify the CSS class of an array of page links.
1690 $linkcolour_ids: array of prefixed DB keys of the pages linked to,
1691 indexed by page_id.
1692 &$colours: (output) array of CSS classes, indexed by prefixed DB keys
1693 $title: Title object of the page being parsed, on which the links will be shown
1694
1695 'GetLocalURL': Modify local URLs as output into page links. Note that if you are
1696 working with internal urls (non-interwiki) then it may be preferable to work
1697 with the GetLocalURL::Internal or GetLocalURL::Article hooks as GetLocalURL can
1698 be buggy for internal urls on render if you do not re-implement the horrible
1699 hack that Title::getLocalURL uses in your own extension.
1700 &$title: Title object of page
1701 &$url: string value as output (out parameter, can modify)
1702 $query: query options as string passed to Title::getLocalURL()
1703
1704 'GetLocalURL::Article': Modify local URLs specifically pointing to article paths
1705 without any fancy queries or variants.
1706 &$title: Title object of page
1707 &$url: string value as output (out parameter, can modify)
1708
1709 'GetLocalURL::Internal': Modify local URLs to internal pages.
1710 &$title: Title object of page
1711 &$url: string value as output (out parameter, can modify)
1712 $query: query options as string passed to Title::getLocalURL()
1713
1714 'GetLogTypesOnUser': Add log types where the target is a userpage
1715 &$types: Array of log types
1716
1717 'GetMetadataVersion': Modify the image metadata version currently in use. This
1718 is used when requesting image metadata from a ForeignApiRepo. Media handlers
1719 that need to have versioned metadata should add an element to the end of the
1720 version array of the form 'handler_name=version'. Most media handlers won't need
1721 to do this unless they broke backwards compatibility with a previous version of
1722 the media handler metadata output.
1723 &$version: Array of version strings
1724
1725 'GetNewMessagesAlert': Disable or modify the new messages alert
1726 &$newMessagesAlert: An empty string by default. If the user has new talk page
1727 messages, this should be populated with an alert message to that effect
1728 $newtalks: An empty array if the user has no new messages or an array
1729 containing links and revisions if there are new messages (See
1730 User::getNewMessageLinks)
1731 $user: The user object of the user who is loading the page
1732 $out: OutputPage object (to check what type of page the user is on)
1733
1734 'GetPreferences': Modify user preferences.
1735 $user: User whose preferences are being modified.
1736 &$preferences: Preferences description array, to be fed to an HTMLForm object
1737
1738 'GetRelativeTimestamp': Pre-emptively override the relative timestamp generated
1739 by MWTimestamp::getRelativeTimestamp(). Return false in this hook to use the
1740 custom output.
1741 &$output: string for the output timestamp
1742 &$diff: DateInterval representing the difference between the timestamps
1743 $timestamp: MWTimestamp object of the current (user-adjusted) timestamp
1744 $relativeTo: MWTimestamp object of the relative (user-adjusted) timestamp
1745 $user: User whose preferences are being used to make timestamp
1746 $lang: Language that will be used to render the timestamp
1747
1748 'GetSlotDiffRenderer': Replace or wrap the standard SlotDiffRenderer for some
1749 content type.
1750 $contentHandler: ContentHandler for which the slot diff renderer is fetched.
1751 &$slotDiffRenderer: SlotDiffRenderer to change or replace.
1752 $context: IContextSource
1753
1754 'getUserPermissionsErrors': Add a permissions error when permissions errors are
1755 checked for. Use instead of userCan for most cases. Return false if the user
1756 can't do it, and populate $result with the reason in the form of
1757 [ messagename, param1, param2, ... ] or a MessageSpecifier instance (you
1758 might want to use ApiMessage to provide machine-readable details for the API).
1759 For consistency, error messages
1760 should be plain text with no special coloring, bolding, etc. to show that
1761 they're errors; presenting them properly to the user as errors is done by the
1762 caller.
1763 &$title: Title object being checked against
1764 &$user: Current user object
1765 $action: Action being checked
1766 &$result: User permissions error to add. If none, return true.
1767
1768 'getUserPermissionsErrorsExpensive': Equal to getUserPermissionsErrors, but is
1769 called only if expensive checks are enabled. Add a permissions error when
1770 permissions errors are checked for. Return false if the user can't do it, and
1771 populate $result with the reason in the form of [ messagename, param1, param2,
1772 ... ] or a MessageSpecifier instance (you might want to use ApiMessage to
1773 provide machine-readable details for the API). For consistency, error messages
1774 should be plain text with no special coloring, bolding, etc. to show that
1775 they're errors; presenting them properly to the user as errors is done by the
1776 caller.
1777 &$title: Title object being checked against
1778 &$user: Current user object
1779 $action: Action being checked
1780 &$result: User permissions error to add. If none, return true.
1781
1782 'GitViewers': Called when generating the list of git viewers for
1783 Special:Version, use this to change the list.
1784 &$extTypes: associative array of repo URLS to viewer URLs.
1785
1786 'HistoryRevisionTools': Override or extend the revision tools available from the
1787 page history view, i.e. undo, rollback, etc.
1788 $rev: Revision object
1789 &$links: Array of HTML links
1790 $prevRev: Revision object, next in line in page history, or null
1791 $user: Current user object
1792
1793 'HistoryPageToolLinks': Add one or more links to revision history page subtitle.
1794 $context: IContextSource (object)
1795 $linkRenderer: LinkRenderer instance
1796 &$links: Array of HTML strings
1797
1798 'HTMLFileCache::useFileCache': Override whether a page should be cached in file
1799 cache.
1800 $context: An IContextSource object with information about the request being
1801 served.
1802
1803 'ImageBeforeProduceHTML': Called before producing the HTML created by a wiki
1804 image insertion. You can skip the default logic entirely by returning false, or
1805 just modify a few things using call-by-reference.
1806 &$skin: Skin object
1807 &$title: Title object of the image
1808 &$file: File object, or false if it doesn't exist
1809 &$frameParams: Various parameters with special meanings; see documentation in
1810 includes/Linker.php for Linker::makeImageLink
1811 &$handlerParams: Various parameters with special meanings; see documentation in
1812 includes/Linker.php for Linker::makeImageLink
1813 &$time: Timestamp of file in 'YYYYMMDDHHIISS' string form, or false for current
1814 &$res: Final HTML output, used if you return false
1815 $parser: Parser instance
1816 &$query: Query params for desc URL
1817 &$widthOption: Used by the parser to remember the user preference thumbnailsize
1818
1819 'ImageOpenShowImageInlineBefore': Call potential extension just before showing
1820 the image on an image page.
1821 &$imagePage: ImagePage object ($this)
1822 &$output: $wgOut
1823
1824 'ImagePageAfterImageLinks': Called after the image links section on an image
1825 page is built.
1826 $imagePage: ImagePage object ($this)
1827 &$html: HTML for the hook to add
1828
1829 'ImagePageFileHistoryLine': Called when a file history line is constructed.
1830 $imagePage: ImagePage object ($this)
1831 $file: the file
1832 &$line: the HTML of the history line
1833 &$css: the line CSS class
1834
1835 'ImagePageFindFile': Called when fetching the file associated with an image
1836 page.
1837 $page: ImagePage object
1838 &$file: File object
1839 &$displayFile: displayed File object
1840
1841 'ImagePageShowTOC': Called when the file toc on an image page is generated.
1842 $page: ImagePage object
1843 &$toc: Array of <li> strings
1844
1845 'ImgAuthBeforeStream': executed before file is streamed to user, but only when
1846 using img_auth.php.
1847 &$title: the Title object of the file as it would appear for the upload page
1848 &$path: the original file and path name when img_auth was invoked by the web
1849 server
1850 &$name: the name only component of the file
1851 &$result: The location to pass back results of the hook routine (only used if
1852 failed)
1853 $result[0]=The index of the header message
1854 $result[1]=The index of the body text message
1855 $result[2 through n]=Parameters passed to body text message. Please note the
1856 header message cannot receive/use parameters.
1857
1858 'ImportHandleLogItemXMLTag': When parsing a XML tag in a log item.
1859 Return false to stop further processing of the tag
1860 $reader: XMLReader object
1861 $logInfo: Array of information
1862
1863 'ImportHandlePageXMLTag': When parsing a XML tag in a page.
1864 Return false to stop further processing of the tag
1865 $reader: XMLReader object
1866 &$pageInfo: Array of information
1867
1868 'ImportHandleRevisionXMLTag': When parsing a XML tag in a page revision.
1869 Return false to stop further processing of the tag
1870 $reader: XMLReader object
1871 $pageInfo: Array of page information
1872 $revisionInfo: Array of revision information
1873
1874 'ImportHandleToplevelXMLTag': When parsing a top level XML tag.
1875 Return false to stop further processing of the tag
1876 $reader: XMLReader object
1877
1878 'ImportHandleUnknownUser': When a user doesn't exist locally, this hook is
1879 called to give extensions an opportunity to auto-create it. If the auto-creation
1880 is successful, return false.
1881 $name: User name
1882
1883 'ImportHandleUploadXMLTag': When parsing a XML tag in a file upload.
1884 Return false to stop further processing of the tag
1885 $reader: XMLReader object
1886 $revisionInfo: Array of information
1887
1888 'ImportLogInterwikiLink': Hook to change the interwiki link used in log entries
1889 and edit summaries for transwiki imports.
1890 &$fullInterwikiPrefix: Interwiki prefix, may contain colons.
1891 &$pageTitle: String that contains page title.
1892
1893 'ImportSources': Called when reading from the $wgImportSources configuration
1894 variable. Can be used to lazy-load the import sources list.
1895 &$importSources: The value of $wgImportSources. Modify as necessary. See the
1896 comment in DefaultSettings.php for the detail of how to structure this array.
1897
1898 'InfoAction': When building information to display on the action=info page.
1899 $context: IContextSource object
1900 &$pageInfo: Array of information
1901
1902 'InitializeArticleMaybeRedirect': MediaWiki check to see if title is a redirect.
1903 &$title: Title object for the current page
1904 &$request: WebRequest
1905 &$ignoreRedirect: boolean to skip redirect check
1906 &$target: Title/string of redirect target
1907 &$article: Article object
1908
1909 'InternalParseBeforeLinks': during Parser's internalParse method before links
1910 but after nowiki/noinclude/includeonly/onlyinclude and other processings.
1911 &$parser: Parser object
1912 &$text: string containing partially parsed text
1913 &$stripState: Parser's internal StripState object
1914
1915 'InternalParseBeforeSanitize': during Parser's internalParse method just before
1916 the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/
1917 includeonly/onlyinclude and other processings. Ideal for syntax-extensions after
1918 template/parser function execution which respect nowiki and HTML-comments.
1919 &$parser: Parser object
1920 &$text: string containing partially parsed text
1921 &$stripState: Parser's internal StripState object
1922
1923 'InterwikiLoadPrefix': When resolving if a given prefix is an interwiki or not.
1924 Return true without providing an interwiki to continue interwiki search.
1925 $prefix: interwiki prefix we are looking for.
1926 &$iwData: output array describing the interwiki with keys iw_url, iw_local,
1927 iw_trans and optionally iw_api and iw_wikiid.
1928
1929 'InvalidateEmailComplete': Called after a user's email has been invalidated
1930 successfully.
1931 $user: user (object) whose email is being invalidated
1932
1933 'IRCLineURL': When constructing the URL to use in an IRC notification.
1934 Callee may modify $url and $query, URL will be constructed as $url . $query
1935 &$url: URL to index.php
1936 &$query: Query string
1937 $rc: RecentChange object that triggered url generation
1938
1939 'IsFileCacheable': Override the result of Article::isFileCacheable() (if true)
1940 &$article: article (object) being checked
1941
1942 'IsTrustedProxy': Override the result of IP::isTrustedProxy()
1943 &$ip: IP being check
1944 &$result: Change this value to override the result of IP::isTrustedProxy()
1945
1946 'IsUploadAllowedFromUrl': Override the result of UploadFromUrl::isAllowedUrl()
1947 $url: URL used to upload from
1948 &$allowed: Boolean indicating if uploading is allowed for given URL
1949
1950 'isValidEmailAddr': Override the result of Sanitizer::validateEmail(), for
1951 instance to return false if the domain name doesn't match your organization.
1952 $addr: The e-mail address entered by the user
1953 &$result: Set this and return false to override the internal checks
1954
1955 'isValidPassword': Override the result of User::isValidPassword()
1956 $password: The password entered by the user
1957 &$result: Set this and return false to override the internal checks
1958 $user: User the password is being validated for
1959
1960 'Language::getMessagesFileName':
1961 $code: The language code or the language we're looking for a messages file for
1962 &$file: The messages file path, you can override this to change the location.
1963
1964 'LanguageGetNamespaces': Provide custom ordering for namespaces or
1965 remove namespaces. Do not use this hook to add namespaces. Use
1966 CanonicalNamespaces for that.
1967 &$namespaces: Array of namespaces indexed by their numbers
1968
1969 'LanguageGetTranslatedLanguageNames': Provide translated language names.
1970 &$names: array of language code => language name
1971 $code: language of the preferred translations
1972
1973 'LanguageLinks': Manipulate a page's language links. This is called
1974 in various places to allow extensions to define the effective language
1975 links for a page.
1976 $title: The page's Title.
1977 &$links: Array with elements of the form "language:title" in the order
1978 that they will be output.
1979 &$linkFlags: Associative array mapping prefixed links to arrays of flags.
1980 Currently unused, but planned to provide support for marking individual
1981 language links in the UI, e.g. for featured articles.
1982
1983 'LanguageSelector': Hook to change the language selector available on a page.
1984 $out: The output page.
1985 $cssClassName: CSS class name of the language selector.
1986
1987 'LinkBegin': DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead.
1988 Used when generating internal and interwiki links in Linker::link(), before
1989 processing starts. Return false to skip default processing and return $ret. See
1990 documentation for Linker::link() for details on the expected meanings of
1991 parameters.
1992 $skin: the Skin object
1993 $target: the Title that the link is pointing to
1994 &$html: the contents that the <a> tag should have (raw HTML); null means
1995 "default".
1996 &$customAttribs: the HTML attributes that the <a> tag should have, in
1997 associative array form, with keys and values unescaped. Should be merged
1998 with default values, with a value of false meaning to suppress the
1999 attribute.
2000 &$query: the query string to add to the generated URL (the bit after the "?"),
2001 in associative array form, with keys and values unescaped.
2002 &$options: array of options. Can include 'known', 'broken', 'noclasses'.
2003 &$ret: the value to return if your hook returns false.
2004
2005 'LinkEnd': DEPRECATED since 1.28! Use HtmlPageLinkRendererEnd hook instead
2006 Used when generating internal and interwiki links in Linker::link(),
2007 just before the function returns a value. If you return true, an <a> element
2008 with HTML attributes $attribs and contents $html will be returned. If you
2009 return false, $ret will be returned.
2010 $skin: the Skin object
2011 $target: the Title object that the link is pointing to
2012 $options: the options. Will always include either 'known' or 'broken', and may
2013 include 'noclasses'.
2014 &$html: the final (raw HTML) contents of the <a> tag, after processing.
2015 &$attribs: the final HTML attributes of the <a> tag, after processing, in
2016 associative array form.
2017 &$ret: the value to return if your hook returns false.
2018
2019 'LinkerMakeExternalImage': At the end of Linker::makeExternalImage() just
2020 before the return.
2021 &$url: the image url
2022 &$alt: the image's alt text
2023 &$img: the new image HTML (if returning false)
2024
2025 'LinkerMakeExternalLink': At the end of Linker::makeExternalLink() just
2026 before the return.
2027 &$url: the link url
2028 &$text: the link text
2029 &$link: the new link HTML (if returning false)
2030 &$attribs: the attributes to be applied.
2031 $linkType: The external link type
2032
2033 'LinkerMakeMediaLinkFile': At the end of Linker::makeMediaLinkFile() just
2034 before the return.
2035 $title: the Title object that the link is pointing to
2036 $file: the File object or false if broken link
2037 &$html: the link text
2038 &$attribs: the attributes to be applied
2039 &$ret: the value to return if your hook returns false
2040
2041 'LogEventsListLineEnding': Called before a Special:Log line is finished
2042 $page: the LogEventsList object
2043 &$ret: the HTML line
2044 $entry: the DatabaseLogEntry object for this row
2045 &$classes: the classes to add to the surrounding <li>
2046 &$attribs: associative array of other HTML attributes for the <li> element.
2047 Currently only data attributes reserved to MediaWiki are allowed
2048 (see Sanitizer::isReservedDataAttribute).
2049
2050
2051 'HtmlPageLinkRendererBegin':
2052 Used when generating internal and interwiki links in
2053 LinkRenderer, before processing starts. Return false to skip default
2054 processing and return $ret.
2055 $linkRenderer: the LinkRenderer object
2056 $target: the LinkTarget that the link is pointing to
2057 &$text: the contents that the <a> tag should have; either a plain, unescaped
2058 string or a HtmlArmor object; null means "default".
2059 &$customAttribs: the HTML attributes that the <a> tag should have, in
2060 associative array form, with keys and values unescaped. Should be merged
2061 with default values, with a value of false meaning to suppress the
2062 attribute.
2063 &$query: the query string to add to the generated URL (the bit after the "?"),
2064 in associative array form, with keys and values unescaped.
2065 &$ret: the value to return if your hook returns false.
2066
2067 'HtmlPageLinkRendererEnd':
2068 Used when generating internal and interwiki links in LinkRenderer,
2069 just before the function returns a value. If you return true, an <a> element
2070 with HTML attributes $attribs and contents $html will be returned. If you
2071 return false, $ret will be returned.
2072 $linkRenderer: the LinkRenderer object
2073 $target: the LinkTarget object that the link is pointing to
2074 $isKnown: boolean indicating whether the page is known or not
2075 &$text: the contents that the <a> tag should have; either a plain, unescaped
2076 string or a HtmlArmor object.
2077 &$attribs: the final HTML attributes of the <a> tag, after processing, in
2078 associative array form.
2079 &$ret: the value to return if your hook returns false.
2080
2081 'LinksUpdate': At the beginning of LinksUpdate::doUpdate() just before the
2082 actual update.
2083 &$linksUpdate: the LinksUpdate object
2084
2085 'LinksUpdateAfterInsert': At the end of LinksUpdate::incrTableUpdate() after
2086 each link table insert. For example, pagelinks, imagelinks, externallinks.
2087 $linksUpdate: LinksUpdate object
2088 $table: the table to insert links to
2089 $insertions: an array of links to insert
2090
2091 'LinksUpdateComplete': At the end of LinksUpdate::doUpdate() when updating,
2092 including delete and insert, has completed for all link tables
2093 &$linksUpdate: the LinksUpdate object
2094 $ticket: prior result of LBFactory::getEmptyTransactionTicket()
2095
2096 'LinksUpdateConstructed': At the end of LinksUpdate() is construction.
2097 &$linksUpdate: the LinksUpdate object
2098
2099 'ListDefinedTags': When trying to find all defined tags.
2100 &$tags: The list of tags.
2101
2102 'LoadExtensionSchemaUpdates': Called during database installation and updates.
2103 $updater: A DatabaseUpdater subclass
2104
2105 'LocalFile::getHistory': Called before file history query performed.
2106 &$file: the File object
2107 &$tables: tables
2108 &$fields: select fields
2109 &$conds: conditions
2110 &$opts: query options
2111 &$join_conds: JOIN conditions
2112
2113 'LocalFilePurgeThumbnails': Called before thumbnails for a local file a purged.
2114 $file: the File object
2115 $archiveName: name of an old file version or false if it's the current one
2116
2117 'LocalisationCacheRecache': Called when loading the localisation data into
2118 cache.
2119 $cache: The LocalisationCache object
2120 $code: language code
2121 &$alldata: The localisation data from core and extensions
2122 &$purgeBlobs: whether to purge/update the message blobs via
2123 MessageBlobStore::clear()
2124
2125 'LocalisationCacheRecacheFallback': Called for each language when merging
2126 fallback data into the cache.
2127 $cache: The LocalisationCache object
2128 $code: language code
2129 &$alldata: The localisation data from core and extensions. Note some keys may
2130 be omitted if they won't be merged into the final result.
2131
2132 'LocalisationChecksBlacklist': When fetching the blacklist of
2133 localisation checks.
2134 &$blacklist: array of checks to blacklist. See the bottom of
2135 maintenance/language/checkLanguage.inc for the format of this variable.
2136
2137 'LocalisationIgnoredOptionalMessages': When fetching the list of ignored and
2138 optional localisation messages
2139 &$ignored: Array of ignored message keys
2140 &$optional: Array of optional message keys
2141
2142 'LocalUserCreated': Called when a local user has been created
2143 $user: User object for the created user
2144 $autocreated: Boolean, whether this was an auto-creation
2145
2146 'LogEventsListGetExtraInputs': When getting extra inputs to display on
2147 Special:Log for a specific log type
2148 $type: String of log type being displayed
2149 $logEventsList: LogEventsList object for context and access to the WebRequest
2150 &$input: string HTML of an input element (deprecated, use $formDescriptor instead)
2151 &$formDescriptor: array HTMLForm's form descriptor
2152
2153 'LogEventsListShowLogExtract': Called before the string is added to OutputPage.
2154 Returning false will prevent the string from being added to the OutputPage.
2155 &$s: html string to show for the log extract
2156 $types: String or Array Log types to show
2157 $page: String or Title The page title to show log entries for
2158 $user: String The user who made the log entries
2159 $param: Associative Array with the following additional options:
2160 - lim Integer Limit of items to show, default is 50
2161 - conds Array Extra conditions for the query (e.g. "log_action != 'revision'")
2162 - showIfEmpty boolean Set to false if you don't want any output in case the
2163 loglist is empty if set to true (default), "No matching items in log" is
2164 displayed if loglist is empty
2165 - msgKey Array If you want a nice box with a message, set this to the key of
2166 the message. First element is the message key, additional optional elements
2167 are parameters for the key that are processed with
2168 wfMessage()->params()->parseAsBlock()
2169 - offset Set to overwrite offset parameter in $wgRequest set to '' to unset
2170 offset
2171 - wrap String Wrap the message in html (usually something like
2172 "&lt;div ...>$1&lt;/div>").
2173 - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS)
2174
2175 'LogException': Called before an exception (or PHP error) is logged. This is
2176 meant for integration with external error aggregation services; returning false
2177 will NOT prevent logging.
2178 $e: The exception (in case of a plain old PHP error, a wrapping ErrorException)
2179 $suppressed: true if the error was suppressed via
2180 error_reporting()/wfSuppressWarnings()
2181
2182 'LoginFormValidErrorMessages': Called in LoginForm when a function gets valid
2183 error messages. Allows to add additional error messages (except messages already
2184 in LoginForm::$validErrorMessages).
2185 &$messages: Already added messages (inclusive messages from
2186 LoginForm::$validErrorMessages)
2187
2188 'LogLine': Processes a single log entry on Special:Log.
2189 $log_type: string for the type of log entry (e.g. 'move'). Corresponds to
2190 logging.log_type database field.
2191 $log_action: string for the type of log action (e.g. 'delete', 'block',
2192 'create2'). Corresponds to logging.log_action database field.
2193 $title: Title object that corresponds to logging.log_namespace and
2194 logging.log_title database fields.
2195 $paramArray: Array of parameters that corresponds to logging.log_params field.
2196 Note that only $paramArray[0] appears to contain anything.
2197 &$comment: string that corresponds to logging.log_comment database field, and
2198 which is displayed in the UI.
2199 &$revert: string that is displayed in the UI, similar to $comment.
2200 $time: timestamp of the log entry (added in 1.12)
2201
2202 'LonelyPagesQuery': Allow extensions to modify the query used by
2203 Special:LonelyPages.
2204 &$tables: tables to join in the query
2205 &$conds: conditions for the query
2206 &$joinConds: join conditions for the query
2207
2208 'MagicWordwgVariableIDs': When defining new magic words IDs.
2209 &$variableIDs: array of strings
2210
2211 'MaintenanceRefreshLinksInit': before executing the refreshLinks.php maintenance
2212 script.
2213 $refreshLinks: RefreshLinks object
2214
2215 'MakeGlobalVariablesScript': Called at end of OutputPage::getJSVars.
2216 Ideally, this hook should only be used to add variables that depend on
2217 the current page/request; static configuration should be added through
2218 ResourceLoaderGetConfigVars instead.
2219 &$vars: variable (or multiple variables) to be added into the output of
2220 Skin::makeVariablesScript
2221 $out: The OutputPage which called the hook, can be used to get the real title.
2222
2223 'MarkPatrolled': Before an edit is marked patrolled.
2224 $rcid: ID of the revision to be marked patrolled
2225 &$user: the user (object) marking the revision as patrolled
2226 $wcOnlySysopsCanPatrol: config setting indicating whether the user needs to be a
2227 sysop in order to mark an edit patrolled.
2228 $auto: true if the edit is being marked as patrolled automatically
2229
2230 'MarkPatrolledComplete': After an edit is marked patrolled.
2231 $rcid: ID of the revision marked as patrolled
2232 &$user: user (object) who marked the edit patrolled
2233 $wcOnlySysopsCanPatrol: config setting indicating whether the user must be a
2234 sysop to patrol the edit.
2235 $auto: true if the edit is being marked as patrolled automatically
2236
2237 'ApiMaxLagInfo': When lag information is being requested via API. Use this to
2238 override lag information. Generally a hook function should only replace
2239 $lagInfo if the new $lagInfo['lag'] is greater than the current $lagInfo['lag'].
2240 &$lagInfo: Maximum lag information array. Fields in the array are:
2241 'lag' is the number of seconds of lag.
2242 'host' is the host name on which the lag exists.
2243 'type' is an indication of the type of lag,
2244 e.g. "db" for database replication lag or "jobqueue" for job queue size
2245 converted to pseudo-seconds.
2246 It is possible to add more fields and they will be returned to the user in
2247 the API response.
2248
2249 'MediaWikiPerformAction': Override MediaWiki::performAction(). Use this to do
2250 something completely different, after the basic globals have been set up, but
2251 before ordinary actions take place.
2252 $output: $wgOut
2253 $article: Article on which the action will be performed
2254 $title: Title on which the action will be performed
2255 $user: $wgUser
2256 $request: $wgRequest
2257 $mediaWiki: The $mediawiki object
2258
2259 'MediaWikiServices': Called when a global MediaWikiServices instance is
2260 initialized. Extensions may use this to define, replace, or wrap services.
2261 However, the preferred way to define a new service is
2262 the $wgServiceWiringFiles array.
2263 $services: MediaWikiServices
2264
2265 'MessageCache::get': When fetching a message. Can be used to override the key
2266 for customisations. Given and returned message key must be in special format:
2267 1) first letter must be in lower case according to the content language.
2268 2) spaces must be replaced with underscores
2269 &$key: message key (string)
2270
2271 'MessageCacheReplace': When a message page is changed. Useful for updating
2272 caches.
2273 $title: name of the page changed.
2274 $text: new contents of the page.
2275
2276 'MessagesPreLoad': When loading a message from the database.
2277 $title: title of the message (string)
2278 &$message: value (string), change it to the message you want to define
2279 $code: code (string) denoting the language to try.
2280
2281 'MimeMagicGuessFromContent': Allows MW extensions guess the MIME by content.
2282 $mimeMagic: Instance of MimeAnalyzer.
2283 &$head: First 1024 bytes of the file in a string (in - Do not alter!).
2284 &$tail: More or equal than last 65558 bytes of the file in a string
2285 (in - Do not alter!).
2286 $file: File path.
2287 &$mime: MIME type (out).
2288
2289 'MimeMagicImproveFromExtension': Allows MW extensions to further improve the
2290 MIME type detected by considering the file extension.
2291 $mimeMagic: Instance of MimeAnalyzer.
2292 $ext: File extension.
2293 &$mime: MIME type (in/out).
2294
2295 'MimeMagicInit': Before processing the list mapping MIME types to media types
2296 and the list mapping MIME types to file extensions.
2297 As an extension author, you are encouraged to submit patches to MediaWiki's
2298 core to add new MIME types to mime.types.
2299 $mimeMagic: Instance of MimeAnalyzer.
2300 Use $mimeMagic->addExtraInfo( $stringOfInfo );
2301 for adding new MIME info to the list.
2302 Use $mimeMagic->addExtraTypes( $stringOfTypes );
2303 for adding new MIME types to the list.
2304
2305 'ModifyExportQuery': Modify the query used by the exporter.
2306 $db: The database object to be queried.
2307 &$tables: Tables in the query.
2308 &$conds: Conditions in the query.
2309 &$opts: Options for the query.
2310 &$join_conds: Join conditions for the query.
2311
2312 'MovePageCheckPermissions': Specify whether the user is allowed to move the
2313 page.
2314 $oldTitle: Title object of the current (old) location
2315 $newTitle: Title object of the new location
2316 $user: User making the move
2317 $reason: string of the reason provided by the user
2318 $status: Status object to pass error messages to
2319
2320 'MovePageIsValidMove': Specify whether a page can be moved for technical
2321 reasons.
2322 $oldTitle: Title object of the current (old) location
2323 $newTitle: Title object of the new location
2324 $status: Status object to pass error messages to
2325
2326 'NamespaceIsMovable': Called when determining if it is possible to pages in a
2327 namespace.
2328 $index: Integer; the index of the namespace being checked.
2329 &$result: Boolean; whether MediaWiki currently thinks that pages in this
2330 namespace are movable. Hooks may change this value to override the return
2331 value of MWNamespace::isMovable().
2332
2333 'NewDifferenceEngine': Called when a new DifferenceEngine object is made
2334 $title: the diff page title (nullable)
2335 &$oldId: the actual old Id to use in the diff
2336 &$newId: the actual new Id to use in the diff (0 means current)
2337 $old: the ?old= param value from the url
2338 $new: the ?new= param value from the url
2339
2340 'NewPagesLineEnding': Called before a NewPages line is finished.
2341 $page: the SpecialNewPages object
2342 &$ret: the HTML line
2343 $row: the database row for this page (the recentchanges record and a few extras
2344 - see NewPagesPager::getQueryInfo)
2345 &$classes: the classes to add to the surrounding <li>
2346 &$attribs: associative array of other HTML attributes for the <li> element.
2347 Currently only data attributes reserved to MediaWiki are allowed
2348 (see Sanitizer::isReservedDataAttribute).
2349
2350 'NewRevisionFromEditComplete': Called when a revision was inserted due to an
2351 edit.
2352 $wikiPage: the WikiPage edited
2353 $rev: the new revision
2354 $originalRevId: if the edit restores or repeats an earlier revision (such as a
2355 rollback or a null revision), the ID of that earlier revision. False otherwise.
2356 (Used to be called $baseID.)
2357 $user: the editing user
2358 &$tags: tags to apply to the edit and recent change
2359
2360 'OldChangesListRecentChangesLine': Customize entire recent changes line, or
2361 return false to omit the line from RecentChanges and Watchlist special pages.
2362 &$changeslist: The OldChangesList instance.
2363 &$s: HTML of the form "<li>...</li>" containing one RC entry.
2364 $rc: The RecentChange object.
2365 &$classes: array of css classes for the <li> element.
2366 &$attribs: associative array of other HTML attributes for the <li> element.
2367 Currently only data attributes reserved to MediaWiki are allowed
2368 (see Sanitizer::isReservedDataAttribute).
2369
2370 'OpenSearchUrls': Called when constructing the OpenSearch description XML. Hooks
2371 can alter or append to the array of URLs for search & suggestion formats.
2372 &$urls: array of associative arrays with Url element attributes
2373
2374 'OpportunisticLinksUpdate': Called by WikiPage::triggerOpportunisticLinksUpdate
2375 when a page view triggers a re-rendering of the page. This may happen
2376 particularly if the parser cache is split by user language, and no cached
2377 rendering of the page exists in the user's language. The hook is called
2378 before checking whether page_links_updated indicates that the links are up
2379 to date. Returning false will cause triggerOpportunisticLinksUpdate() to abort
2380 without triggering any updates.
2381 $page: the Page that was rendered.
2382 $title: the Title of the rendered page.
2383 $parserOutput: ParserOutput resulting from rendering the page.
2384
2385 'OtherAutoblockLogLink': Get links to the autoblock log from extensions which
2386 autoblocks users and/or IP addresses too.
2387 &$otherBlockLink: An array with links to other autoblock logs
2388
2389 'OtherBlockLogLink': Get links to the block log from extensions which blocks
2390 users and/or IP addresses too.
2391 &$otherBlockLink: An array with links to other block logs
2392 $ip: The requested IP address or username
2393
2394 'OutputPageAfterGetHeadLinksArray': Called in OutputPage#getHeadLinksArray right
2395 before returning the result.
2396 &$tags: array containing all <head> links generated so far. The array format is
2397 "link name or number => 'link HTML'".
2398 $out: the OutputPage object
2399
2400 'OutputPageBeforeHTML': A page has been processed by the parser and the
2401 resulting HTML is about to be displayed.
2402 &$parserOutput: the parserOutput (object) that corresponds to the page
2403 &$text: the text that will be displayed, in HTML (string)
2404
2405 'OutputPageBodyAttributes': Called when OutputPage::headElement is creating the
2406 body tag to allow for extensions to add attributes to the body of the page they
2407 might need. Or to allow building extensions to add body classes that aren't of
2408 high enough demand to be included in core.
2409 $out: The OutputPage which called the hook, can be used to get the real title
2410 $sk: The Skin that called OutputPage::headElement
2411 &$bodyAttrs: An array of attributes for the body tag passed to Html::openElement
2412
2413 'OutputPageCheckLastModified': when checking if the page has been modified
2414 since the last visit.
2415 &$modifiedTimes: array of timestamps.
2416 The following keys are set: page, user, epoch
2417 $out: OutputPage object (since 1.28)
2418
2419 'OutputPageMakeCategoryLinks': Links are about to be generated for the page's
2420 categories. Implementations should return false if they generate the category
2421 links, so the default link generation is skipped.
2422 &$out: OutputPage instance (object)
2423 $categories: associative array, keys are category names, values are category
2424 types ("normal" or "hidden")
2425 &$links: array, intended to hold the result. Must be an associative array with
2426 category types as keys and arrays of HTML links as values.
2427
2428 'OutputPageParserOutput': after adding a parserOutput to $wgOut
2429 &$out: OutputPage instance (object)
2430 $parserOutput: parserOutput instance being added in $out
2431
2432 'PageContentInsertComplete': After a new article is created.
2433 $wikiPage: WikiPage created
2434 $user: User creating the article
2435 $content: New content as a Content object
2436 $summary: Edit summary/comment
2437 $isMinor: Whether or not the edit was marked as minor
2438 $isWatch: (No longer used)
2439 $section: (No longer used)
2440 $flags: Flags passed to WikiPage::doEditContent()
2441 $revision: New Revision of the article
2442
2443 'PageContentLanguage': Allows changing the language in which the content of a
2444 page is written. Defaults to the wiki content language ($wgContLang).
2445 $title: Title object
2446 &$pageLang: the page content language (either an object or a language code)
2447 $wgLang: the user language
2448
2449 'PageContentSave': Before an article is saved.
2450 $wikiPage: the WikiPage (object) being saved
2451 $user: the user (object) saving the article
2452 $content: the new article content, as a Content object
2453 $summary: the article summary (comment)
2454 $isminor: minor flag
2455 $iswatch: watch flag
2456 $section: section #
2457
2458 'PageContentSaveComplete': After an article has been updated.
2459 $wikiPage: WikiPage modified
2460 $user: User performing the modification
2461 $content: New content, as a Content object
2462 $summary: Edit summary/comment
2463 $isMinor: Whether or not the edit was marked as minor
2464 $isWatch: (No longer used)
2465 $section: (No longer used)
2466 $flags: Flags passed to WikiPage::doEditContent()
2467 $revision: New Revision of the article (can be null for edits that change
2468 nothing)
2469 $status: Status object about to be returned by doEditContent()
2470 $originalRevId: if the edit restores or repeats an earlier revision (such as a
2471 rollback or a null revision), the ID of that earlier revision. False otherwise.
2472 (Used to be called $baseRevId.)
2473 $undidRevId: the rev ID (or 0) this edit undid
2474
2475 'PageDeletionDataUpdates': Called when constructing a list of DeferrableUpdate to be
2476 executed when a page is deleted.
2477 $title The Title of the page being deleted.
2478 $revision A RevisionRecord representing the page's current revision at the time of deletion.
2479 &$updates A list of DeferrableUpdate that can be manipulated by the hook handler.
2480
2481 'PageHistoryBeforeList': When a history page list is about to be constructed.
2482 &$article: the article that the history is loading for
2483 $context: RequestContext object
2484
2485 'PageHistoryLineEnding': Right before the end <li> is added to a history line.
2486 $historyAction: the action object
2487 &$row: the revision row for this line
2488 &$s: the string representing this parsed line
2489 &$classes: array containing the <li> element classes
2490 &$attribs: associative array of other HTML attributes for the <li> element.
2491 Currently only data attributes reserved to MediaWiki are allowed
2492 (see Sanitizer::isReservedDataAttribute).
2493
2494 'PageHistoryPager::doBatchLookups': Called after the pager query was run, before
2495 any output is generated, to allow batch lookups for prefetching information
2496 needed for display. If the hook handler returns false, the regular behavior of
2497 doBatchLookups() is skipped.
2498 $pager: the PageHistoryPager
2499 $result: a ResultWrapper representing the query result
2500
2501 'PageHistoryPager::getQueryInfo': when a history pager query parameter set is
2502 constructed.
2503 &$pager: the pager
2504 &$queryInfo: the query parameters
2505
2506 'PageRenderingHash': NOTE: Consider using ParserOptionsRegister instead.
2507 Alter the parser cache option hash key. A parser extension
2508 which depends on user options should install this hook and append its values to
2509 the key.
2510 &$confstr: reference to a hash key string which can be modified
2511 $user: User (object) requesting the page
2512 &$forOptions: array of options the hash is for
2513
2514 'PageViewUpdates': Allow database (or other) changes to be made after a
2515 page view is seen by MediaWiki. Note this does not capture views made
2516 via external caches such as Squid.
2517 $wikipage: WikiPage (object) for the page being viewed.
2518 $user: User (object) for the user who is viewing.
2519
2520 'ParserAfterParse': Called from Parser::parse() just after the call to
2521 Parser::internalParse() returns.
2522 &$parser: parser object
2523 &$text: text being parsed
2524 &$stripState: stripState used (object)
2525
2526 'ParserAfterStrip': Called at end of parsing time.
2527 TODO: No more strip, deprecated ?
2528 &$parser: parser object
2529 &$text: text being parsed
2530 &$stripState: stripState used (object)
2531
2532 'ParserAfterTidy': Called after Parser::tidy() in Parser::parse()
2533 &$parser: Parser object being used
2534 &$text: text that will be returned
2535
2536 'ParserAfterUnstrip': Called after the first unstripGeneral() in
2537 Parser::internalParseHalfParsed()
2538 &$parser: Parser object being used
2539 &$text: text that will be returned
2540
2541 'ParserBeforeInternalParse': Called at the beginning of Parser::internalParse().
2542 &$parser: Parser object
2543 &$text: text to parse
2544 &$stripState: StripState instance being used
2545
2546 'ParserBeforeStrip': Called at start of parsing time.
2547 TODO: No more strip, deprecated ?
2548 &$parser: parser object
2549 &$text: text being parsed
2550 &$stripState: stripState used (object)
2551
2552 'ParserBeforeTidy': Called before tidy and custom tags replacements.
2553 &$parser: Parser object being used
2554 &$text: actual text
2555
2556 'ParserCacheSaveComplete': Called after a ParserOutput has been committed to
2557 the parser cache.
2558 $parserCache: ParserCache object $parserOutput was stored in
2559 $parserOutput: ParserOutput object that was stored
2560 $title: Title of the page that was parsed to generate $parserOutput
2561 $popts: ParserOptions used for generating $parserOutput
2562 $revId: ID of the revision that was parsed to create $parserOutput
2563
2564 'ParserClearState': Called at the end of Parser::clearState().
2565 &$parser: Parser object being cleared
2566
2567 'ParserCloned': Called when the parser is cloned.
2568 $parser: Newly-cloned Parser object
2569
2570 'ParserFetchTemplate': Called when the parser fetches a template
2571 $parser: Parser Parser object or false
2572 $title: Title object of the template to be fetched
2573 $rev: Revision object of the template
2574 &$text: Transclusion text of the template or false or null
2575 &$deps: Array of template dependencies with 'title', 'page_id', 'rev_id' keys
2576
2577 'ParserFirstCallInit': Called when the parser initialises for the first time.
2578 &$parser: Parser object being cleared
2579
2580 'ParserGetVariableValueSwitch': Called when the parser need the value of a
2581 custom magic word
2582 &$parser: Parser object
2583 &$varCache: array to store the value in case of multiples calls of the
2584 same magic word
2585 &$index: index (string) of the magic
2586 &$ret: value of the magic word (the hook should set it)
2587 &$frame: PPFrame object to use for expanding any template variables
2588
2589 'ParserGetVariableValueTs': Use this to change the value of the time for the
2590 {{LOCAL...}} magic word.
2591 &$parser: Parser object
2592 &$time: actual time (timestamp)
2593
2594 'ParserGetVariableValueVarCache': use this to change the value of the variable
2595 cache or return false to not use it.
2596 &$parser: Parser object
2597 &$varCache: variable cache (array)
2598
2599 'ParserLimitReportFormat': Called for each row in the parser limit report that
2600 needs formatting. If nothing handles this hook, the default is to use "$key" to
2601 get the label, and "$key-value" or "$key-value-text"/"$key-value-html" to
2602 format the value.
2603 $key: Key for the limit report item (string)
2604 &$value: Value of the limit report item
2605 &$report: String onto which to append the data
2606 $isHTML: If true, $report is an HTML table with two columns; if false, it's
2607 text intended for display in a monospaced font.
2608 $localize: If false, $report should be output in English.
2609
2610 'ParserLimitReportPrepare': Called at the end of Parser:parse() when the parser
2611 will include comments about size of the text parsed. Hooks should use
2612 $output->setLimitReportData() to populate data. Functions for this hook should
2613 not use $wgLang; do that in ParserLimitReportFormat instead.
2614 $parser: Parser object
2615 $output: ParserOutput object
2616
2617 'ParserMakeImageParams': Called before the parser make an image link, use this
2618 to modify the parameters of the image.
2619 $title: title object representing the file
2620 $file: file object that will be used to create the image
2621 &$params: 2-D array of parameters
2622 $parser: Parser object that called the hook
2623
2624 'ParserOptionsRegister': Register additional parser options. Note that if you
2625 change the default value for an option, all existing parser cache entries will
2626 be invalid. To avoid bugs, you'll need to handle that somehow (e.g. with the
2627 RejectParserCacheValue hook) because MediaWiki won't do it for you.
2628 &$defaults: Set the default value for your option here.
2629 &$inCacheKey: To fragment the parser cache on your option, set a truthy value
2630 here.
2631 &$lazyLoad: To lazy-initialize your option, set it null in $defaults and set a
2632 callable here. The callable is passed the ParserOptions object and the option
2633 name.
2634
2635 'ParserOutputPostCacheTransform': Called from ParserOutput::getText() to do
2636 post-cache transforms.
2637 $parserOutput: The ParserOutput object.
2638 &$text: The text being transformed, before core transformations are done.
2639 &$options: The options array being used for the transformation.
2640
2641 'ParserSectionCreate': Called each time the parser creates a document section
2642 from wikitext. Use this to apply per-section modifications to HTML (like
2643 wrapping the section in a DIV). Caveat: DIVs are valid wikitext, and a DIV
2644 can begin in one section and end in another. Make sure your code can handle
2645 that case gracefully. See the EditSectionClearerLink extension for an example.
2646 $parser: the calling Parser instance
2647 $section: the section number, zero-based, but section 0 is usually empty
2648 &$sectionContent: ref to the content of the section. modify this.
2649 $showEditLinks: boolean describing whether this section has an edit link
2650
2651 'ParserTestGlobals': Allows to define globals for parser tests.
2652 &$globals: Array with all the globals which should be set for parser tests.
2653 The arrays keys serve as the globals names, its values are the globals values.
2654
2655 'ParserTestTables': Alter the list of tables to duplicate when parser tests are
2656 run. Use when page save hooks require the presence of custom tables to ensure
2657 that tests continue to run properly.
2658 &$tables: array of table names
2659
2660 'ParserOutputStashForEdit': Called when an edit stash parse finishes, before the
2661 output is cached.
2662 $page: the WikiPage of the candidate edit
2663 $content: the Content object of the candidate edit
2664 $output: the ParserOutput result of the candidate edit
2665 $summary: the change summary of the candidate edit
2666 $user: the User considering the edit
2667
2668 'PasswordPoliciesForUser': Alter the effective password policy for a user.
2669 $user: User object whose policy you are modifying
2670 &$effectivePolicy: Array of policy statements that apply to this user
2671
2672 'PerformRetroactiveAutoblock': Called before a retroactive autoblock is applied
2673 to a user.
2674 $block: Block object (which is set to be autoblocking)
2675 &$blockIds: Array of block IDs of the autoblock
2676
2677 'PersonalUrls': Alter the user-specific navigation links (e.g. "my page,
2678 my talk page, my contributions" etc).
2679 &$personal_urls: Array of link specifiers (see SkinTemplate.php)
2680 &$title: Title object representing the current page
2681 $skin: SkinTemplate object providing context (e.g. to check if the user is
2682 logged in, etc.)
2683
2684 'PingLimiter': Allows extensions to override the results of User::pingLimiter().
2685 &$user: User performing the action
2686 $action: Action being performed
2687 &$result: Whether or not the action should be prevented
2688 Change $result and return false to give a definitive answer, otherwise
2689 the built-in rate limiting checks are used, if enabled.
2690 $incrBy: Amount to increment counter by
2691
2692 'PlaceNewSection': Override placement of new sections. Return false and put the
2693 merged text into $text to override the default behavior.
2694 $wikipage: WikiPage object
2695 $oldtext: the text of the article before editing
2696 $subject: subject of the new section
2697 &$text: text of the new section
2698
2699 'PostLoginRedirect': Modify the post login redirect behavior.
2700 Occurs after signing up or logging in, allows for interception of redirect.
2701 &$returnTo: The page name to return to, as a string
2702 &$returnToQuery: array of url parameters, mapping parameter names to values
2703 &$type: type of login redirect as string;
2704 error: display a return to link ignoring $wgRedirectOnLogin
2705 signup: display a return to link using $wgRedirectOnLogin if needed
2706 success: display a return to link using $wgRedirectOnLogin if needed
2707 successredirect: send an HTTP redirect using $wgRedirectOnLogin if needed
2708
2709 'PreferencesFormPreSave': Override preferences being saved
2710 $formData: array of user submitted data
2711 $form: HTMLForm object, also a ContextSource
2712 $user: User object with preferences to be saved set
2713 &$result: boolean indicating success
2714 $oldUserOptions: array with user old options (before save)
2715
2716 'PreferencesGetLegend': Override the text used for the <legend> of a
2717 preferences section.
2718 $form: the HTMLForm object. This is a ContextSource as well
2719 $key: the section name
2720 &$legend: the legend text. Defaults to wfMessage( "prefs-$key" )->text() but may
2721 be overridden
2722
2723 'PrefixSearchBackend': DEPRECATED since 1.27! Override
2724 SearchEngine::completionSearchBackend instead.
2725 Override the title prefix search used for OpenSearch and
2726 AJAX search suggestions. Put results into &$results outparam and return false.
2727 $ns: array of int namespace keys to search in
2728 $search: search term (not guaranteed to be conveniently normalized)
2729 $limit: maximum number of results to return
2730 &$results: out param: array of page names (strings)
2731 $offset: number of results to offset from the beginning
2732
2733 'PrefixSearchExtractNamespace': Called if core was not able to extract a
2734 namespace from the search string so that extensions can attempt it.
2735 &$namespaces: array of int namespace keys to search in (change this if you can
2736 extract namespaces)
2737 &$search: search term (replace this with term without the namespace if you can
2738 extract one)
2739
2740 'PrefsEmailAudit': Called when user changes their email address.
2741 $user: User (object) changing his email address
2742 $oldaddr: old email address (string)
2743 $newaddr: new email address (string)
2744
2745 'ProtectionForm::buildForm': Called after all protection type fieldsets are made
2746 in the form.
2747 $article: the title being (un)protected
2748 &$output: a string of the form HTML so far
2749
2750 'ProtectionForm::save': Called when a protection form is submitted.
2751 $article: the Page being (un)protected
2752 &$errorMsg: an html message string of an error or an array of message name and
2753 its parameters
2754 $reasonstr: a string describing the reason page protection level is altered
2755
2756 'ProtectionForm::showLogExtract': Called after the protection log extract is
2757 shown.
2758 $article: the page the form is shown for
2759 $out: OutputPage object
2760
2761 'RandomPageQuery': Lets you modify the query used by Special:Random to select
2762 random pages.
2763 &$tables: Database tables to be used in the query
2764 &$conds: Conditions to be applied in the query
2765 &$joinConds: Join conditions to be applied in the query
2766
2767 'RawPageViewBeforeOutput': Right before the text is blown out in action=raw.
2768 &$obj: RawAction object
2769 &$text: The text that's going to be the output
2770
2771 'RecentChange_save': Called at the end of RecentChange::save().
2772 &$recentChange: RecentChange object
2773
2774 'RecentChangesPurgeRows': Called when old recentchanges rows are purged, after
2775 deleting those rows but within the same transaction.
2776 $rows: The deleted rows as an array of recentchanges row objects (with up to
2777 $wgUpdateRowsPerQuery items).
2778
2779 'RedirectSpecialArticleRedirectParams': Lets you alter the set of parameter
2780 names such as "oldid" that are preserved when using redirecting special pages
2781 such as Special:MyPage and Special:MyTalk.
2782 &$redirectParams: An array of parameters preserved by redirecting special pages.
2783
2784 'RejectParserCacheValue': Return false to reject an otherwise usable
2785 cached value from the Parser cache. NOTE: CARELESS USE OF THIS HOOK CAN
2786 HAVE CATASTROPHIC CONSEQUENCES FOR HIGH-TRAFFIC INSTALLATIONS. USE WITH
2787 EXTREME CARE.
2788 $parserOutput: ParserOutput value.
2789 $wikiPage: WikiPage object.
2790 $parserOptions: ParserOptions object.
2791
2792 'RequestContextCreateSkin': Called when RequestContext::getSkin creates a skin
2793 instance. Can be used by an extension override what skin is used in certain
2794 contexts.
2795 $context: (IContextSource) The RequestContext the skin is being created for.
2796 &$skin: A variable reference you may set a Skin instance or string key on to
2797 override the skin that will be used for the context.
2798
2799 'RequestHasSameOriginSecurity': Called to determine if the request is somehow
2800 flagged to lack same-origin security. Return false to indicate the lack. Note
2801 if the "somehow" involves HTTP headers, you'll probably need to make sure
2802 the header is varied on.
2803 $request: The WebRequest object.
2804
2805 'ResetPasswordExpiration': Allow extensions to set a default password expiration
2806 $user: The user having their password expiration reset
2807 &$newExpire: The new expiration date
2808
2809 'ResourceLoaderForeignApiModules': Called from ResourceLoaderForeignApiModule.
2810 Use this to add dependencies to 'mediawiki.ForeignApi' module when you wish
2811 to override its behavior. See the module docs for more information.
2812 &$dependencies: string[] List of modules that 'mediawiki.ForeignApi' should
2813 depend on
2814 $context: ResourceLoaderContext|null
2815
2816 'ResourceLoaderGetConfigVars': Called at the end of
2817 ResourceLoaderStartUpModule::getConfigSettings(). Use this to export static
2818 configuration variables to JavaScript. Things that depend on the current page
2819 or request state must be added through MakeGlobalVariablesScript instead.
2820 Skin is made available for skin specific config.
2821 &$vars: [ variable name => value ]
2822 $skin: Skin
2823
2824 'ResourceLoaderJqueryMsgModuleMagicWords': Called in
2825 ResourceLoaderJqueryMsgModule to allow adding magic words for jQueryMsg.
2826 The value should be a string, and they can depend only on the
2827 ResourceLoaderContext.
2828 $context: ResourceLoaderContext
2829 &$magicWords: Associative array mapping all-caps magic word to a string value
2830
2831 'ResourceLoaderRegisterModules': Right before modules information is required,
2832 such as when responding to a resource
2833 loader request or generating HTML output.
2834 &$resourceLoader: ResourceLoader object
2835
2836 'ResourceLoaderTestModules': Let you add new JavaScript testing modules. This is
2837 called after the addition of 'qunit' and MediaWiki testing resources.
2838 &$testModules: array of JavaScript testing modules. The 'qunit' framework,
2839 included in core, is fed using tests/qunit/QUnitTestResources.php.
2840 To add a new qunit module named 'myext.tests':
2841 $testModules['qunit']['myext.tests'] = [
2842 'script' => 'extension/myext/tests.js',
2843 'dependencies' => <any module dependency you might have>
2844 ];
2845 For QUnit framework, the mediawiki.tests.qunit.testrunner dependency will be
2846 added to any module.
2847 &$ResourceLoader: object
2848
2849 'RevisionDataUpdates': Called when constructing a list of DeferrableUpdate to be
2850 executed to record secondary data about a revision.
2851 $title The Title of the page the revision belongs to
2852 $renderedRevision a RenderedRevision object representing the new revision and providing access
2853 to the RevisionRecord as well as ParserOutput of that revision.
2854 &$updates A list of DeferrableUpdate that can be manipulated by the hook handler.
2855
2856 'RevisionRecordInserted': Called after a revision is inserted into the database.
2857 $revisionRecord: the RevisionRecord that has just been inserted.
2858
2859 'RevisionInsertComplete': DEPRECATED since 1.31! Use RevisionRecordInserted hook
2860 instead. Called after a revision is inserted into the database.
2861 $revision: the Revision
2862 $data: DEPRECATED! Always null!
2863 $flags: DEPRECATED! Always null!
2864
2865 'SearchableNamespaces': An option to modify which namespaces are searchable.
2866 &$arr: Array of namespaces ($nsId => $name) which will be used.
2867
2868 'SearchAfterNoDirectMatch': If there was no match for the exact result. This
2869 runs before lettercase variants are attempted, whereas 'SearchGetNearMatch'
2870 runs after.
2871 $term: Search term string
2872 &$title: Outparam; set to $title object and return false for a match
2873
2874 'SearchGetNearMatch': An extra chance for exact-title-matches in "go" searches
2875 if nothing was found.
2876 $term: Search term string
2877 &$title: Outparam; set to $title object and return false for a match
2878
2879 'SearchGetNearMatchBefore': Perform exact-title-matches in "go" searches before
2880 the normal operations.
2881 $allSearchTerms: Array of the search terms in all content languages
2882 &$titleResult: Outparam; the value to return. A Title object or null.
2883
2884 'SearchGetNearMatchComplete': A chance to modify exact-title-matches in "go"
2885 searches.
2886 $term: Search term string
2887 &$title: Current Title object that is being returned (null if none found).
2888
2889 'SearchResultInitFromTitle': Set the revision used when displaying a page in
2890 search results.
2891 $title: Current Title object being displayed in search results.
2892 &$id: Revision ID (default is false, for latest)
2893
2894 'SearchIndexFields': Add fields to search index mapping.
2895 &$fields: Array of fields, all implement SearchIndexField
2896 $engine: SearchEngine instance for which mapping is being built.
2897
2898 'SearchDataForIndex': Add data to search document. Allows to add any data to
2899 the field map used to index the document.
2900 &$fields: Array of name => value pairs for fields
2901 $handler: ContentHandler for the content being indexed
2902 $page: WikiPage that is being indexed
2903 $output: ParserOutput that is produced from the page
2904 $engine: SearchEngine for which the indexing is intended
2905
2906 'SearchResultsAugment': Allows extension to add its code to the list of search
2907 result augmentors.
2908 &$setAugmentors: List of whole-set augmentor objects, must implement
2909 ResultSetAugmentor.
2910 &$rowAugmentors: List of per-row augmentor objects, must implement
2911 ResultAugmentor.
2912 Note that lists should be in the format name => object and the names in both
2913 lists should be distinct.
2914
2915 'SecondaryDataUpdates': DEPRECATED! Use RevisionDataUpdates or override
2916 ContentHandler::getSecondaryDataUpdates instead.
2917 Allows modification of the list of DataUpdates to perform when page content is modified.
2918 $title: Title of the page that is being edited.
2919 $oldContent: Content object representing the page's content before the edit.
2920 $recursive: bool indicating whether DataUpdates should trigger recursive
2921 updates (relevant mostly for LinksUpdate).
2922 $parserOutput: ParserOutput representing the rendered version of the page
2923 after the edit.
2924 &$updates: a list of DataUpdate objects, to be modified or replaced by
2925 the hook handler.
2926
2927 'SecuritySensitiveOperationStatus': Affect the return value from
2928 MediaWiki\Auth\AuthManager::securitySensitiveOperationStatus().
2929 &$status: (string) The status to be returned. One of the AuthManager::SEC_*
2930 constants. SEC_REAUTH will be automatically changed to SEC_FAIL if
2931 authentication isn't possible for the current session type.
2932 $operation: (string) The operation being checked.
2933 $session: (MediaWiki\Session\Session) The current session. The
2934 currently-authenticated user may be retrieved as $session->getUser().
2935 $timeSinceAuth: (int) The time since last authentication. PHP_INT_MAX if
2936 the time of last auth is unknown, or -1 if authentication is not possible.
2937
2938 'SelfLinkBegin': Called before a link to the current article is displayed to
2939 allow the display of the link to be customized.
2940 $nt: the Title object
2941 &$html: html to display for the link
2942 &$trail: optional text to display before $html
2943 &$prefix: optional text to display after $html
2944 &$ret: the value to return if your hook returns false
2945
2946 'SendWatchlistEmailNotification': Return true to send watchlist email
2947 notification
2948 $targetUser: the user whom to send watchlist email notification
2949 $title: the page title
2950 $enotif: EmailNotification object
2951
2952 'SessionCheckInfo': Validate a MediaWiki\Session\SessionInfo as it's being
2953 loaded from storage. Return false to prevent it from being used.
2954 &$reason: String rejection reason to be logged
2955 $info: MediaWiki\Session\SessionInfo being validated
2956 $request: WebRequest being loaded from
2957 $metadata: Array|false Metadata array for the MediaWiki\Session\Session
2958 $data: Array|false Data array for the MediaWiki\Session\Session
2959
2960 'SessionMetadata': Add metadata to a session being saved.
2961 $backend: MediaWiki\Session\SessionBackend being saved.
2962 &$metadata: Array Metadata to be stored. Add new keys here.
2963 $requests: Array of WebRequests potentially being saved to. Generally 0-1 real
2964 request and 0+ FauxRequests.
2965
2966 'SetupAfterCache': Called in Setup.php, after cache objects are set
2967
2968 'ShortPagesQuery': Allow extensions to modify the query used by
2969 Special:ShortPages.
2970 &$tables: tables to join in the query
2971 &$conds: conditions for the query
2972 &$joinConds: join conditions for the query
2973 &$options: options for the query
2974
2975 'ShowMissingArticle': Called when generating the output for a non-existent page.
2976 $article: The article object corresponding to the page
2977
2978 'ShowSearchHit': Customize display of search hit.
2979 $searchPage: The SpecialSearch instance.
2980 $result: The SearchResult to show
2981 $terms: Search terms, for highlighting
2982 &$link: HTML of link to the matching page. May be modified.
2983 &$redirect: HTML of redirect info. May be modified.
2984 &$section: HTML of matching section. May be modified.
2985 &$extract: HTML of content extract. May be modified.
2986 &$score: HTML of score. May be modified.
2987 &$size: HTML of page size. May be modified.
2988 &$date: HTML of of page modification date. May be modified.
2989 &$related: HTML of additional info for the matching page. May be modified.
2990 &$html: May be set to the full HTML that should be used to represent the search
2991 hit. Must include the <li> ... </li> tags. Will only be used if the hook
2992 function returned false.
2993
2994 'ShowSearchHitTitle': Customise display of search hit title/link.
2995 &$title: Title to link to
2996 &$titleSnippet: Label for the link representing the search result. Typically the
2997 article title.
2998 $result: The SearchResult object
2999 $terms: String of the search terms entered
3000 $specialSearch: The SpecialSearch object
3001 &$query: Array of query string parameters for the link representing the search
3002 result.
3003 &$attributes: Array of title link attributes, can be modified by extension.
3004
3005 'SidebarBeforeOutput': Allows to edit sidebar just before it is output by skins.
3006 Warning: This hook is run on each display. You should consider to use
3007 'SkinBuildSidebar' that is aggressively cached.
3008 $skin: Skin object
3009 &$bar: Sidebar content
3010 Modify $bar to add or modify sidebar portlets.
3011
3012 'SiteNoticeAfter': After the sitenotice/anonnotice is composed.
3013 &$siteNotice: HTML sitenotice. Alter the contents of $siteNotice to add to/alter
3014 the sitenotice/anonnotice.
3015 $skin: Skin object
3016
3017 'SiteNoticeBefore': Before the sitenotice/anonnotice is composed. Return true to
3018 allow the normal method of notice selection/rendering to work, or change the
3019 value of $siteNotice and return false to alter it.
3020 &$siteNotice: HTML returned as the sitenotice
3021 $skin: Skin object
3022
3023 'SkinAfterBottomScripts': At the end of Skin::bottomScripts().
3024 $skin: Skin object
3025 &$text: bottomScripts Text. Append to $text to add additional text/scripts after
3026 the stock bottom scripts.
3027
3028 'SkinAfterContent': Allows extensions to add text after the page content and
3029 article metadata. This hook should work in all skins. Set the &$data variable to
3030 the text you're going to add.
3031 &$data: (string) Text to be printed out directly (without parsing)
3032 $skin: Skin object
3033
3034 'SkinBuildSidebar': At the end of Skin::buildSidebar().
3035 $skin: Skin object
3036 &$bar: Sidebar contents
3037 Modify $bar to add or modify sidebar portlets.
3038
3039 'SkinCopyrightFooter': Allow for site and per-namespace customization of
3040 copyright notice.
3041 $title: displayed page title
3042 $type: 'normal' or 'history' for old/diff views
3043 &$msg: overridable message; usually 'copyright' or 'history_copyright'. This
3044 message must be in HTML format, not wikitext!
3045 &$link: overridable HTML link to be passed into the message as $1
3046 &$forContent: DEPRECATED! overridable flag if copyright footer is shown in
3047 content language.
3048
3049 'SkinEditSectionLinks': Modify the section edit links
3050 $skin: Skin object rendering the UI
3051 $title: Title object for the title being linked to (may not be the same as
3052 the page title, if the section is included from a template)
3053 $section: The designation of the section being pointed to, to be included in
3054 the link, like "&section=$section"
3055 $tooltip: The default tooltip. Escape before using.
3056 By default, this is wrapped in the 'editsectionhint' message.
3057 &$result: Array containing all link detail arrays. Each link detail array should
3058 contain the following keys:
3059 - targetTitle - Target Title object
3060 - text - String for the text
3061 - attribs - Array of attributes
3062 - query - Array of query parameters to add to the URL
3063 - options - Array of options for Linker::link
3064 $lang: The language code to use for the link in the wfMessage function
3065
3066 'SkinGetPoweredBy': TODO
3067 &$text: additional 'powered by' icons in HTML. Note: Modern skin does not use
3068 the MediaWiki icon but plain text instead.
3069 $skin: Skin object
3070
3071 'SkinPreloadExistence': Supply titles that should be added to link existence
3072 cache before the page is rendered.
3073 &$titles: Array of Title objects
3074 $skin: Skin object
3075
3076 'SkinSubPageSubtitle': At the beginning of Skin::subPageSubtitle().
3077 If false is returned $subpages will be used instead of the HTML
3078 subPageSubtitle() generates.
3079 If true is returned, $subpages will be ignored and the rest of
3080 subPageSubtitle() will run.
3081 &$subpages: Subpage links HTML
3082 $skin: Skin object
3083 $out: OutputPage object
3084
3085 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink': After creating the "permanent
3086 link" tab.
3087 &$sktemplate: SkinTemplate object
3088 &$nav_urls: array of tabs
3089 &$revid: The revision id of the permanent link
3090 &$revid2: The revision id of the permanent link, second time
3091
3092 'SkinTemplateGetLanguageLink': After building the data for a language link from
3093 which the actual html is constructed.
3094 &$languageLink: array containing data about the link. The following keys can be
3095 modified: href, text, title, class, lang, hreflang. Each of them is a string.
3096 $languageLinkTitle: Title object belonging to the external language link.
3097 $title: Title object of the page the link belongs to.
3098 $outputPage: The OutputPage object the links are built from.
3099
3100 'SkinTemplateNavigation': Called on content pages after the tabs have been
3101 added, but before variants have been added.
3102 &$sktemplate: SkinTemplate object
3103 &$links: Structured navigation links. This is used to alter the navigation for
3104 skins which use buildNavigationUrls such as Vector.
3105
3106 'SkinTemplateNavigation::SpecialPage': Called on special pages after the special
3107 tab is added but before variants have been added.
3108 &$sktemplate: SkinTemplate object
3109 &$links: Structured navigation links. This is used to alter the navigation for
3110 skins which use buildNavigationUrls such as Vector.
3111
3112 'SkinTemplateNavigation::Universal': Called on both content and special pages
3113 after variants have been added.
3114 &$sktemplate: SkinTemplate object
3115 &$links: Structured navigation links. This is used to alter the navigation for
3116 skins which use buildNavigationUrls such as Vector.
3117
3118 'SkinTemplateOutputPageBeforeExec': Before SkinTemplate::outputPage() starts
3119 page output.
3120 &$sktemplate: SkinTemplate object
3121 &$tpl: QuickTemplate engine object
3122
3123 'SkinTemplatePreventOtherActiveTabs': Use this to prevent showing active tabs.
3124 &$sktemplate: SkinTemplate object
3125 &$res: set to true to prevent active tabs
3126
3127 'SkinTemplateTabAction': Override SkinTemplate::tabAction().
3128 You can either create your own array, or alter the parameters for
3129 the normal one.
3130 &$sktemplate: The SkinTemplate instance.
3131 $title: Title instance for the page.
3132 $message: Visible label of tab.
3133 $selected: Whether this is a selected tab.
3134 $checkEdit: Whether or not the action=edit query should be added if appropriate.
3135 &$classes: Array of CSS classes to apply.
3136 &$query: Query string to add to link.
3137 &$text: Link text.
3138 &$result: Complete assoc. array if you want to return true.
3139
3140 'SkinTemplateToolboxEnd': Called by SkinTemplate skins after toolbox links have
3141 been rendered (useful for adding more).
3142 &$sk: The QuickTemplate based skin template running the hook.
3143 $dummy: Called when SkinTemplateToolboxEnd is used from a BaseTemplate skin,
3144 extensions that add support for BaseTemplateToolbox should watch for this
3145 dummy parameter with "$dummy=false" in their code and return without echoing
3146 any HTML to avoid creating duplicate toolbox items.
3147
3148 'SoftwareInfo': Called by Special:Version for returning information about the
3149 software.
3150 &$software: The array of software in format 'name' => 'version'. See
3151 SpecialVersion::softwareInformation().
3152
3153 'SpecialBlockModifyFormFields': Add more fields to Special:Block
3154 $sp: SpecialPage object, for context
3155 &$fields: Current HTMLForm fields
3156
3157 'SpecialContributionsBeforeMainOutput': Before the form on Special:Contributions
3158 $id: User id number, only provided for backwards-compatibility
3159 $user: User object representing user contributions are being fetched for
3160 $sp: SpecialPage instance, providing context
3161
3162 'SpecialContributions::formatRow::flags': Called before rendering a
3163 Special:Contributions row.
3164 $context: IContextSource object
3165 $row: Revision information from the database
3166 &$flags: List of flags on this row
3167
3168 'SpecialContributions::getForm::filters': Called with a list of filters to render
3169 on Special:Contributions.
3170 $sp: SpecialContributions object, for context
3171 &$filters: List of filters rendered as HTML
3172
3173 'SpecialListusersDefaultQuery': Called right before the end of
3174 UsersPager::getDefaultQuery().
3175 $pager: The UsersPager instance
3176 &$query: The query array to be returned
3177
3178 'SpecialListusersFormatRow': Called right before the end of
3179 UsersPager::formatRow().
3180 &$item: HTML to be returned. Will be wrapped in an <li> after the hook finishes
3181 $row: Database row object
3182
3183 'SpecialListusersHeader': Called after adding the submit button in
3184 UsersPager::getPageHeader().
3185 $pager: The UsersPager instance
3186 &$out: The header HTML
3187
3188 'SpecialListusersHeaderForm': Called before adding the submit button in
3189 UsersPager::getPageHeader().
3190 $pager: The UsersPager instance
3191 &$out: The header HTML
3192
3193 'SpecialListusersQueryInfo': Called right before the end of.
3194 UsersPager::getQueryInfo()
3195 $pager: The UsersPager instance
3196 &$query: The query array to be returned
3197
3198 'SpecialLogAddLogSearchRelations': Add log relations to the current log
3199 $type: String of the log type
3200 $request: WebRequest object for getting the value provided by the current user
3201 &$qc: Array for query conditions to add
3202
3203 'SpecialMovepageAfterMove': Called after moving a page.
3204 &$movePage: MovePageForm object
3205 &$oldTitle: old title (object)
3206 &$newTitle: new title (object)
3207
3208 'SpecialNewpagesConditions': Called when building sql query for
3209 Special:NewPages.
3210 &$special: NewPagesPager object (subclass of ReverseChronologicalPager)
3211 $opts: FormOptions object containing special page options
3212 &$conds: array of WHERE conditionals for query
3213 &$tables: array of tables to be queried
3214 &$fields: array of columns to select
3215 &$join_conds: join conditions for the tables
3216
3217 'SpecialNewPagesFilters': Called after building form options at NewPages.
3218 $special: the special page object
3219 &$filters: associative array of filter definitions. The keys are the HTML
3220 name/URL parameters. Each key maps to an associative array with a 'msg'
3221 (message key) and a 'default' value.
3222
3223 'SpecialPage_initList': Called when setting up SpecialPageFactory::$list, use
3224 this hook to remove a core special page or conditionally register special pages.
3225 &$list: list (array) of core special pages
3226
3227 'SpecialPageAfterExecute': Called after SpecialPage::execute.
3228 $special: the SpecialPage object
3229 $subPage: the subpage string or null if no subpage was specified
3230
3231 'SpecialPageBeforeExecute': Called before SpecialPage::execute.
3232 Return false to prevent execution.
3233 $special: the SpecialPage object
3234 $subPage: the subpage string or null if no subpage was specified
3235
3236 'SpecialPageBeforeFormDisplay': Before executing the HTMLForm object.
3237 $name: name of the special page
3238 &$form: HTMLForm object
3239
3240 'SpecialPasswordResetOnSubmit': When executing a form submission on
3241 Special:PasswordReset.
3242 &$users: array of User objects.
3243 $data: array of data submitted by the user
3244 &$error: string, error code (message key) used to describe to error (out
3245 parameter). The hook needs to return false when setting this, otherwise it
3246 will have no effect.
3247
3248 'SpecialRandomGetRandomTitle': Called during the execution of Special:Random,
3249 use this to change some selection criteria or substitute a different title.
3250 &$randstr: The random number from wfRandom()
3251 &$isRedir: Boolean, whether to select a redirect or non-redirect
3252 &$namespaces: An array of namespace indexes to get the title from
3253 &$extra: An array of extra SQL statements
3254 &$title: If the hook returns false, a Title object to use instead of the
3255 result from the normal query
3256
3257 'SpecialRecentChangesPanel': Called when building form options in
3258 SpecialRecentChanges.
3259 &$extraOpts: array of added items, to which can be added
3260 $opts: FormOptions for this request
3261
3262 'SpecialResetTokensTokens': Called when building token list for
3263 SpecialResetTokens.
3264 &$tokens: array of token information arrays in the format of
3265 [
3266 'preference' => '<preference-name>',
3267 'label-message' => '<message-key>',
3268 ]
3269
3270 'SpecialSearchCreateLink': Called when making the message to create a page or
3271 go to the existing page.
3272 $t: title object searched for
3273 &$params: an array of the default message name and page title (as parameter)
3274
3275 'SpecialSearchGoResult': If a hook returns false the 'go' feature will be
3276 canceled and a normal search will be performed. Returning true without setting
3277 $url does a standard redirect to $title. Setting $url redirects to the
3278 specified URL.
3279 $term: The string the user searched for
3280 $title: The title the 'go' feature has decided to forward the user to
3281 &$url: Initially null, hook subscribers can set this to specify the final url to
3282 redirect to
3283
3284 'SpecialSearchNogomatch': Called when the 'Go' feature is triggered (generally
3285 from autocomplete search other than the main bar on Special:Search) and the
3286 target doesn't exist. Full text search results are generated after this hook is
3287 called.
3288 &$title: title object generated from the text entered by the user
3289
3290 'SpecialSearchPowerBox': The equivalent of SpecialSearchProfileForm for
3291 the advanced form, a.k.a. power search box.
3292 &$showSections: an array to add values with more options to
3293 $term: the search term (not a title object)
3294 &$opts: an array of hidden options (containing 'redirs' and 'profile')
3295
3296 'SpecialSearchProfileForm': Allows modification of search profile forms.
3297 $search: special page object
3298 &$form: String: form html
3299 $profile: String: current search profile
3300 $term: String: search term
3301 $opts: Array: key => value of hidden options for inclusion in custom forms
3302
3303 'SpecialSearchProfiles': Allows modification of search profiles.
3304 &$profiles: profiles, which can be modified.
3305
3306 'SpecialSearchResults': Called before search result display
3307 $term: string of search term
3308 &$titleMatches: empty or SearchResultSet object
3309 &$textMatches: empty or SearchResultSet object
3310
3311 'SpecialSearchResultsPrepend': Called immediately before returning HTML
3312 on the search results page. Useful for including an external search
3313 provider. To disable the output of MediaWiki search output, return
3314 false.
3315 $specialSearch: SpecialSearch object ($this)
3316 $output: $wgOut
3317 $term: Search term specified by the user
3318
3319 'SpecialSearchResultsAppend': Called immediately before returning HTML
3320 on the search results page. Useful for including a feedback link.
3321 $specialSearch: SpecialSearch object ($this)
3322 $output: $wgOut
3323 $term: Search term specified by the user
3324
3325 'SpecialSearchSetupEngine': Allows passing custom data to search engine.
3326 $search: SpecialSearch special page object
3327 $profile: String: current search profile
3328 $engine: the search engine
3329
3330 'SpecialStatsAddExtra': Add extra statistic at the end of Special:Statistics.
3331 &$extraStats: Array to save the new stats
3332 $extraStats['<name of statistic>'] => <value>;
3333 <value> can be an array with the keys "name" and "number":
3334 "name" is the HTML to be displayed in the name column
3335 "number" is the number to be displayed.
3336 or, <value> can be the number to be displayed and <name> is the
3337 message key to use in the name column,
3338 $context: IContextSource object
3339
3340 'SpecialTrackingCategories::preprocess': Called after LinkBatch on
3341 Special:TrackingCategories
3342 $specialPage: The SpecialTrackingCategories object
3343 $trackingCategories: Array of data from Special:TrackingCategories with msg and
3344 cats
3345
3346 'SpecialTrackingCategories::generateCatLink': Called for each cat link on
3347 Special:TrackingCategories
3348 $specialPage: The SpecialTrackingCategories object
3349 $catTitle: The Title object of the linked category
3350 &$html: The Result html
3351
3352 'SpecialUploadComplete': Called after successfully uploading a file from
3353 Special:Upload.
3354 &$form: The SpecialUpload object
3355
3356 'SpecialVersionVersionUrl': Called when building the URL for Special:Version.
3357 $wgVersion: Current $wgVersion for you to use
3358 &$versionUrl: Raw url to link to (eg: release notes)
3359
3360 'SpecialWatchlistGetNonRevisionTypes': Called when building sql query for
3361 SpecialWatchlist. Allows extensions to register custom values they have
3362 inserted to rc_type so they can be returned as part of the watchlist.
3363 &$nonRevisionTypes: array of values in the rc_type field of recentchanges table
3364
3365 'TestCanonicalRedirect': Called when about to force a redirect to a canonical
3366 URL for a title when we have no other parameters on the URL. Gives a chance for
3367 extensions that alter page view behavior radically to abort that redirect or
3368 handle it manually.
3369 $request: WebRequest
3370 $title: Title of the currently found title obj
3371 $output: OutputPage object
3372
3373 'ThumbnailBeforeProduceHTML': Called before an image HTML is about to be
3374 rendered (by ThumbnailImage:toHtml method).
3375 $thumbnail: the ThumbnailImage object
3376 &$attribs: image attribute array
3377 &$linkAttribs: image link attribute array
3378
3379 'TitleArrayFromResult': Called when creating an TitleArray object from a
3380 database result.
3381 &$titleArray: set this to an object to override the default object returned
3382 $res: database result used to create the object
3383
3384 'TitleExists': Called when determining whether a page exists at a given title.
3385 $title: The title being tested.
3386 &$exists: Whether the title exists.
3387
3388 'TitleGetEditNotices': Allows extensions to add edit notices
3389 $title: The Title object for the page the edit notices are for
3390 $oldid: Revision ID that the edit notices are for (or 0 for latest)
3391 &$notices: Array of notices. Keys are i18n message keys, values are
3392 parseAsBlock()ed messages.
3393
3394 'TitleGetRestrictionTypes': Allows extensions to modify the types of protection
3395 that can be applied.
3396 $title: The title in question.
3397 &$types: The types of protection available.
3398
3399 'TitleIsAlwaysKnown': Called when determining if a page exists. Allows
3400 overriding default behavior for determining if a page exists. If $isKnown is
3401 kept as null, regular checks happen. If it's a boolean, this value is returned
3402 by the isKnown method.
3403 $title: Title object that is being checked
3404 &$isKnown: Boolean|null; whether MediaWiki currently thinks this page is known
3405
3406 'TitleIsMovable': Called when determining if it is possible to move a page. Note
3407 that this hook is not called for interwiki pages or pages in immovable
3408 namespaces: for these, isMovable() always returns false.
3409 $title: Title object that is being checked
3410 &$result: Boolean; whether MediaWiki currently thinks this page is movable.
3411 Hooks may change this value to override the return value of
3412 Title::isMovable().
3413
3414
3415 'TitleMove': Before moving an article (title).
3416 $old: old title
3417 $nt: new title
3418 $user: user who does the move
3419 $reason: string of the reason provided by the user
3420 &$status: Status object. To abort the move, add a fatal error to this object
3421 (i.e. call $status->fatal()).
3422
3423 'TitleMoveStarting': Before moving an article (title), but just after the atomic
3424 DB section starts.
3425 $old: old title
3426 $nt: new title
3427 $user: user who does the move
3428
3429 'TitleMoveComplete': After moving an article (title), post-commit.
3430 &$old: old title
3431 &$nt: new title
3432 &$user: user who did the move
3433 $pageid: database ID of the page that's been moved
3434 $redirid: database ID of the created redirect
3435 $reason: reason for the move
3436 $revision: the Revision created by the move
3437
3438 'TitleMoveCompleting': After moving an article (title), pre-commit.
3439 $old: old title
3440 $nt: new title
3441 $user: user who did the move
3442 $pageid: database ID of the page that's been moved
3443 $redirid: database ID of the created redirect
3444 $reason: reason for the move
3445 $revision: the Revision created by the move
3446
3447 'TitleQuickPermissions': Called from Title::checkQuickPermissions to add to
3448 or override the quick permissions check.
3449 $title: The Title object being accessed
3450 $user: The User performing the action
3451 $action: Action being performed
3452 &$errors: Array of errors
3453 $doExpensiveQueries: Whether to do expensive DB queries
3454 $short: Whether to return immediately on first error
3455
3456 'TitleReadWhitelist': Called at the end of read permissions checks, just before
3457 adding the default error message if nothing allows the user to read the page. If
3458 a handler wants a title to *not* be whitelisted, it should also return false.
3459 $title: Title object being checked against
3460 $user: Current user object
3461 &$whitelisted: Boolean value of whether this title is whitelisted
3462
3463 'TitleSquidURLs': Called to determine which URLs to purge from HTTP caches.
3464 $title: Title object to purge
3465 &$urls: An array of URLs to purge from the caches, to be manipulated.
3466
3467 'UnblockUser': Before an IP address or user is unblocked.
3468 &$block: The Block object about to be saved
3469 &$user: The user performing the unblock (not the one being unblocked)
3470 &$reason: If the hook is aborted, the error message to be returned in an array
3471
3472 'UnblockUserComplete': After an IP address or user has been unblocked.
3473 $block: The Block object that was saved
3474 $user: The user who performed the unblock (not the one being unblocked)
3475
3476 'UndeleteForm::showHistory': Called in UndeleteForm::showHistory, after a
3477 PageArchive object has been created but before any further processing is done.
3478 &$archive: PageArchive object
3479 $title: Title object of the page that we're viewing
3480
3481 'UndeleteForm::showRevision': Called in UndeleteForm::showRevision, after a
3482 PageArchive object has been created but before any further processing is done.
3483 &$archive: PageArchive object
3484 $title: Title object of the page that we're viewing
3485
3486 'UndeleteForm::undelete': Called in UndeleteForm::undelete, after checking that
3487 the site is not in read-only mode, that the Title object is not null and after
3488 a PageArchive object has been constructed but before performing any further
3489 processing.
3490 &$archive: PageArchive object
3491 $title: Title object of the page that we're about to undelete
3492
3493 'UndeleteShowRevision': Called when showing a revision in Special:Undelete.
3494 $title: title object related to the revision
3495 $rev: revision (object) that will be viewed
3496
3497 'UnitTestsAfterDatabaseSetup': Called right after MediaWiki's test
3498 infrastructure has finished creating/duplicating core tables for unit tests.
3499 $database: Database in question
3500 $prefix: Table prefix to be used in unit tests
3501
3502 'UnitTestsBeforeDatabaseTeardown': Called right before MediaWiki tears down its
3503 database infrastructure used for unit tests.
3504
3505 'UnitTestsList': Called when building a list of paths containing PHPUnit tests.
3506 Since 1.24: Paths pointing to a directory will be recursively scanned for
3507 test case files matching the suffix "Test.php".
3508 &$paths: list of test cases and directories to search.
3509
3510 'UnwatchArticle': Before a watch is removed from an article.
3511 &$user: user watching
3512 &$page: WikiPage object to be removed
3513 &$status: Status object to be returned if the hook returns false
3514
3515 'UnwatchArticleComplete': After a watch is removed from an article.
3516 $user: user that watched
3517 &$page: WikiPage object that was watched
3518
3519 'UpdateUserMailerFormattedPageStatus': Before notification email gets sent.
3520 &$formattedPageStatus: list of valid page states
3521
3522 'UploadComplete': Upon completion of a file upload.
3523 &$uploadBase: UploadBase (or subclass) object. File can be accessed by
3524 $uploadBase->getLocalFile().
3525
3526 'UploadCreateFromRequest': When UploadBase::createFromRequest has been called.
3527 $type: (string) the requested upload type
3528 &$className: the class name of the Upload instance to be created
3529
3530 'UploadForm:BeforeProcessing': At the beginning of processUpload(). Lets you
3531 poke at member variables like $mUploadDescription before the file is saved.
3532 Do not use this hook to break upload processing.
3533 This will return the user to a blank form with no error message;
3534 use UploadVerifyUpload or UploadVerifyFile instead.
3535 &$upload: SpecialUpload object
3536
3537 'UploadForm:getInitialPageText': After the initial page text for file uploads
3538 is generated, to allow it to be altered.
3539 &$pageText: the page text
3540 $msg: array of header messages
3541 $config: Config object
3542
3543 'UploadForm:initial': Before the upload form is generated. You might set the
3544 member-variables $uploadFormTextTop and $uploadFormTextAfterSummary to inject
3545 text (HTML) either before or after the editform.
3546 &$upload: SpecialUpload object
3547
3548 'UploadFormInitDescriptor': After the descriptor for the upload form as been
3549 assembled.
3550 &$descriptor: (array) the HTMLForm descriptor
3551
3552 'UploadFormSourceDescriptors': after the standard source inputs have been
3553 added to the descriptor
3554 &$descriptor: (array) the HTMLForm descriptor
3555 &$radio: Boolean, if source type should be shown as radio button
3556 $selectedSourceType: The selected source type
3557
3558 'UploadStashFile': Before a file is stashed (uploaded to stash).
3559 Note that code which has not been updated for MediaWiki 1.28 may not call this
3560 hook. If your extension absolutely, positively must prevent some files from
3561 being uploaded, use UploadVerifyFile or UploadVerifyUpload.
3562 $upload: (object) An instance of UploadBase, with all info about the upload
3563 $user: (object) An instance of User, the user uploading this file
3564 $props: (array) File properties, as returned by FSFile::getPropsFromPath()
3565 &$error: output: If the file stashing should be prevented, set this to the
3566 reason in the form of [ messagename, param1, param2, ... ] or a
3567 MessageSpecifier instance (you might want to use ApiMessage to provide machine
3568 -readable details for the API).
3569
3570 'UploadVerification': DEPRECATED since 1.28! Use UploadVerifyFile instead.
3571 Additional chances to reject an uploaded file.
3572 $saveName: (string) destination file name
3573 $tempName: (string) filesystem path to the temporary file for checks
3574 &$error: (string) output: message key for message to show if upload canceled by
3575 returning false. May also be an array, where the first element is the message
3576 key and the remaining elements are used as parameters to the message.
3577
3578 'UploadVerifyFile': extra file verification, based on MIME type, etc. Preferred
3579 in most cases over UploadVerification.
3580 $upload: (object) an instance of UploadBase, with all info about the upload
3581 $mime: (string) The uploaded file's MIME type, as detected by MediaWiki.
3582 Handlers will typically only apply for specific MIME types.
3583 &$error: (object) output: true if the file is valid. Otherwise, set this to the
3584 reason in the form of [ messagename, param1, param2, ... ] or a
3585 MessageSpecifier instance (you might want to use ApiMessage to provide machine
3586 -readable details for the API).
3587
3588 'UploadVerifyUpload': Upload verification, based on both file properties like
3589 MIME type (same as UploadVerifyFile) and the information entered by the user
3590 (upload comment, file page contents etc.).
3591 $upload: (object) An instance of UploadBase, with all info about the upload
3592 $user: (object) An instance of User, the user uploading this file
3593 $props: (array) File properties, as returned by FSFile::getPropsFromPath()
3594 $comment: (string) Upload log comment (also used as edit summary)
3595 $pageText: (string) File description page text (only used for new uploads)
3596 &$error: output: If the file upload should be prevented, set this to the reason
3597 in the form of [ messagename, param1, param2, ... ] or a MessageSpecifier
3598 instance (you might want to use ApiMessage to provide machine-readable details
3599 for the API).
3600
3601 'UserIsBot': when determining whether a user is a bot account
3602 $user: the user
3603 &$isBot: whether this is user a bot or not (boolean)
3604
3605 'User::mailPasswordInternal': before creation and mailing of a user's new
3606 temporary password
3607 &$user: the user who sent the message out
3608 &$ip: IP of the user who sent the message out
3609 &$u: the account whose new password will be set
3610
3611 'UserAddGroup': Called when adding a group or changing a group's expiry; return
3612 false to override stock group addition.
3613 $user: the user object that is to have a group added
3614 &$group: the group to add; can be modified
3615 &$expiry: the expiry time in TS_MW format, or null if the group is not to
3616 expire; can be modified
3617
3618 'UserArrayFromResult': Called when creating an UserArray object from a database
3619 result.
3620 &$userArray: set this to an object to override the default object returned
3621 $res: database result used to create the object
3622
3623 'userCan': To interrupt/advise the "user can do X to Y article" check. If you
3624 want to display an error message, try getUserPermissionsErrors.
3625 &$title: Title object being checked against
3626 &$user: Current user object
3627 $action: Action being checked
3628 &$result: Pointer to result returned if hook returns false. If null is returned,
3629 userCan checks are continued by internal code.
3630
3631 'UserCanSendEmail': To override User::canSendEmail() permission check.
3632 &$user: User (object) whose permission is being checked
3633 &$canSend: bool set on input, can override on output
3634
3635 'UserClearNewTalkNotification': Called when clearing the "You have new
3636 messages!" message, return false to not delete it.
3637 &$user: User (object) that will clear the message
3638 $oldid: ID of the talk page revision being viewed (0 means the most recent one)
3639
3640 'UserEffectiveGroups': Called in User::getEffectiveGroups().
3641 &$user: User to get groups for
3642 &$groups: Current effective groups
3643
3644 'UserGetAllRights': After calculating a list of all available rights.
3645 &$rights: Array of rights, which may be added to.
3646
3647 'UserGetDefaultOptions': After fetching the core default, this hook is run right
3648 before returning the options to the caller. Warning: This hook is called for
3649 every call to User::getDefaultOptions(), which means it's potentially called
3650 dozens or hundreds of times. You may want to cache the results of non-trivial
3651 operations in your hook function for this reason.
3652 &$defaultOptions: Array of preference keys and their default values.
3653
3654 'UserGetEmail': Called when getting an user email address.
3655 $user: User object
3656 &$email: email, change this to override local email
3657
3658 'UserGetEmailAuthenticationTimestamp': Called when getting the timestamp of
3659 email authentication.
3660 $user: User object
3661 &$timestamp: timestamp, change this to override local email authentication
3662 timestamp
3663
3664 'UserGetLanguageObject': Called when getting user's interface language object.
3665 $user: User object
3666 &$code: Language code that will be used to create the object
3667 $context: IContextSource object
3668
3669 'UserGetReservedNames': Allows to modify $wgReservedUsernames at run time.
3670 &$reservedUsernames: $wgReservedUsernames
3671
3672 'UserGetRights': Called in User::getRights().
3673 $user: User to get rights for
3674 &$rights: Current rights
3675
3676 'UserGetRightsRemove': Called in User::getRights(). This hook override
3677 the UserGetRights hook. It can be used to remove rights from user
3678 and ensure that will not be reinserted by the other hook callbacks
3679 therefore this hook should not be used to add any rights, use UserGetRights instead.
3680 $user: User to get rights for
3681 &$rights: Current rights
3682
3683 'UserGroupsChanged': Called after user groups are changed.
3684 $user: User whose groups changed
3685 $added: Groups added
3686 $removed: Groups removed
3687 $performer: User who performed the change, false if via autopromotion
3688 $reason: The reason, if any, given by the user performing the change,
3689 false if via autopromotion.
3690 $oldUGMs: An associative array (group name => UserGroupMembership object) of
3691 the user's group memberships before the change.
3692 $newUGMs: An associative array (group name => UserGroupMembership object) of
3693 the user's current group memberships.
3694
3695 'UserIsBlockedFrom': Check if a user is blocked from a specific page (for
3696 specific block exemptions).
3697 $user: User in question
3698 $title: Title of the page in question
3699 &$blocked: Out-param, whether or not the user is blocked from that page.
3700 &$allowUsertalk: If the user is blocked, whether or not the block allows users
3701 to edit their own user talk pages.
3702
3703 'UserIsBlockedGlobally': Check if user is blocked on all wikis.
3704 &$user: User object
3705 $ip: User's IP address
3706 &$blocked: Whether the user is blocked, to be modified by the hook
3707 &$block: The Block object, to be modified by the hook
3708
3709 'UserIsEveryoneAllowed': Check if all users are allowed some user right; return
3710 false if a UserGetRights hook might remove the named right.
3711 $right: The user right being checked
3712
3713 'UserIsHidden': Check if the user's name should be hidden. See User::isHidden().
3714 $user: User in question.
3715 &$hidden: Set true if the user's name should be hidden.
3716
3717 'UserIsLocked': Check if the user is locked. See User::isLocked().
3718 $user: User in question.
3719 &$locked: Set true if the user should be locked.
3720
3721 'UserLoadAfterLoadFromSession': Called to authenticate users on external or
3722 environmental means; occurs after session is loaded.
3723 $user: user object being loaded
3724
3725 'UserLoadDefaults': Called when loading a default user.
3726 $user: user object
3727 $name: user name
3728
3729 'UserLoadFromDatabase': Called when loading a user from the database.
3730 $user: user object
3731 &$s: database query object
3732
3733 'UserLoadFromSession': DEPRECATED since 1.27! Create a
3734 MediaWiki\Session\SessionProvider instead.
3735 Called to authenticate users on external/environmental means; occurs before
3736 session is loaded.
3737 $user: user object being loaded
3738 &$result: set this to a boolean value to abort the normal authentication
3739 process
3740
3741 'UserLoadOptions': When user options/preferences are being loaded from the
3742 database.
3743 $user: User object
3744 &$options: Options, can be modified.
3745
3746 'UserLoggedIn': Called after a user is logged in
3747 $user: User object for the logged-in user
3748
3749 'UserLoginComplete': Show custom content after a user has logged in via the Web
3750 interface. For functionality that needs to run after any login (API or web) use
3751 UserLoggedIn.
3752 &$user: the user object that was created on login
3753 &$inject_html: Any HTML to inject after the "logged in" message.
3754 $direct: (bool) The hook is called directly after a successful login. This will
3755 only happen once per login. A UserLoginComplete call with direct=false can
3756 happen when the user visits the login page while already logged in.
3757
3758 'UserLogout': Before a user logs out.
3759 &$user: the user object that is about to be logged out
3760
3761 'UserLogoutComplete': After a user has logged out.
3762 &$user: the user object _after_ logout (won't have name, ID, etc.)
3763 &$inject_html: Any HTML to inject after the "logged out" message.
3764 $oldName: name of the user before logout (string)
3765
3766 'UserMailerChangeReturnPath': Called to generate a VERP return address
3767 when UserMailer sends an email, with a bounce handling extension.
3768 $to: Array of MailAddress objects for the recipients
3769 &$returnPath: The return address string
3770
3771 'UserMailerSplitTo': Called in UserMailer::send() to give extensions a chance
3772 to split up an email with multiple the To: field into separate emails.
3773 &$to: array of MailAddress objects; unset the ones which should be mailed
3774 separately
3775
3776 'UserMailerTransformContent': Called in UserMailer::send() to change email
3777 contents. Extensions can block sending the email by returning false and setting
3778 $error.
3779 $to: array of MailAdresses of the targets
3780 $from: MailAddress of the sender
3781 &$body: email body, either a string (for plaintext emails) or an array with
3782 'text' and 'html' keys
3783 &$error: should be set to an error message string
3784
3785 'UserMailerTransformMessage': Called in UserMailer::send() to change email after
3786 it has gone through the MIME transform. Extensions can block sending the email
3787 by returning false and setting $error.
3788 $to: array of MailAdresses of the targets
3789 $from: MailAddress of the sender
3790 &$subject: email subject (not MIME encoded)
3791 &$headers: email headers (except To: and Subject:) as an array of header
3792 name => value pairs
3793 &$body: email body (in MIME format) as a string
3794 &$error: should be set to an error message string
3795
3796 'UserRemoveGroup': Called when removing a group; return false to override stock
3797 group removal.
3798 $user: the user object that is to have a group removed
3799 &$group: the group to be removed, can be modified
3800
3801 'UserRequiresHTTPS': Called to determine whether a user needs
3802 to be switched to HTTPS.
3803 $user: User in question.
3804 &$https: Boolean whether $user should be switched to HTTPS.
3805
3806 'UserResetAllOptions': Called in User::resetOptions() when user preferences
3807 have been requested to be reset. This hook can be used to exclude certain
3808 options from being reset even when the user has requested all prefs to be reset,
3809 because certain options might be stored in the user_properties database table
3810 despite not being visible and editable via Special:Preferences.
3811 $user: the User (object) whose preferences are being reset
3812 &$newOptions: array of new (site default) preferences
3813 $options: array of the user's old preferences
3814 $resetKinds: array containing the kinds of preferences to reset
3815
3816 'UserRetrieveNewTalks': Called when retrieving "You have new messages!"
3817 message(s).
3818 &$user: user retrieving new talks messages
3819 &$talks: array of new talks page(s)
3820
3821 'UserRights': DEPRECATED since 1.26! Use UserGroupsChanged instead.
3822 After a user's group memberships are changed.
3823 &$user: User object that was changed
3824 $add: Array of strings corresponding to groups added
3825 $remove: Array of strings corresponding to groups removed
3826
3827 'UserSaveOptions': Called just before saving user preferences. Hook handlers can
3828 either add or manipulate options, or reset one back to it's default to block
3829 changing it. Hook handlers are also allowed to abort the process by returning
3830 false, e.g. to save to a global profile instead. Compare to the UserSaveSettings
3831 hook, which is called after the preferences have been saved.
3832 $user: The User for which the options are going to be saved
3833 &$options: The users options as an associative array, modifiable
3834
3835 'UserSaveSettings': Called directly after user preferences (user_properties in
3836 the database) have been saved. Compare to the UserSaveOptions hook, which is
3837 called before.
3838 $user: The User for which the options have been saved
3839
3840 'UserSetCookies': DEPRECATED since 1.27! If you're trying to replace core
3841 session cookie handling, you want to create a subclass of
3842 MediaWiki\Session\CookieSessionProvider instead. Otherwise, you can no longer
3843 count on user data being saved to cookies versus some other mechanism.
3844 Called when setting user cookies.
3845 $user: User object
3846 &$session: session array, will be added to the session
3847 &$cookies: cookies array mapping cookie name to its value
3848
3849 'UserSetEmail': Called when changing user email address.
3850 $user: User object
3851 &$email: new email, change this to override new email address
3852
3853 'UserSetEmailAuthenticationTimestamp': Called when setting the timestamp of
3854 email authentication.
3855 $user: User object
3856 &$timestamp: new timestamp, change this to override local email
3857 authentication timestamp
3858
3859 'UserToolLinksEdit': Called when generating a list of user tool links, e.g.
3860 "Foobar (Talk | Contribs | Block)".
3861 $userId: User id of the current user
3862 $userText: User name of the current user
3863 &$items: Array of user tool links as HTML fragments
3864
3865 'UsersPagerDoBatchLookups': Called in UsersPager::doBatchLookups() to give
3866 extensions providing user group data from an alternate source a chance to add
3867 their data into the cache array so that things like global user groups are
3868 displayed correctly in Special:ListUsers.
3869 $dbr: Read-only database handle
3870 $userIds: Array of user IDs whose groups we should look up
3871 &$cache: Array of user ID -> (array of internal group name (e.g. 'sysop') ->
3872 UserGroupMembership object)
3873 &$groups: Array of group name -> bool true mappings for members of a given user
3874 group
3875
3876 'ValidateExtendedMetadataCache': Called to validate the cached metadata in
3877 FormatMetadata::getExtendedMeta (return false means cache will be
3878 invalidated and GetExtendedMetadata hook called again).
3879 $timestamp: The timestamp metadata was generated
3880 $file: The file the metadata is for
3881
3882 'WantedPages::getQueryInfo': Called in WantedPagesPage::getQueryInfo(), can be
3883 used to alter the SQL query which gets the list of wanted pages.
3884 &$wantedPages: WantedPagesPage object
3885 &$query: query array, see QueryPage::getQueryInfo() for format documentation
3886
3887 'WatchArticle': Before a watch is added to an article.
3888 &$user: user that will watch
3889 &$page: WikiPage object to be watched
3890 &$status: Status object to be returned if the hook returns false
3891
3892 'WatchArticleComplete': After a watch is added to an article.
3893 &$user: user that watched
3894 &$page: WikiPage object watched
3895
3896 'WatchedItemQueryServiceExtensions': Create a WatchedItemQueryServiceExtension.
3897 &$extensions: Add WatchedItemQueryServiceExtension objects to this array
3898 $watchedItemQueryService: Service object
3899
3900 'WatchlistEditorBeforeFormRender': Before building the Special:EditWatchlist
3901 form, used to manipulate the list of pages or preload data based on that list.
3902 &$watchlistInfo: array of watchlisted pages in
3903 [namespaceId => ['title1' => 1, 'title2' => 1]] format
3904
3905 'WatchlistEditorBuildRemoveLine': when building remove lines in
3906 Special:Watchlist/edit.
3907 &$tools: array of extra links
3908 $title: Title object
3909 $redirect: whether the page is a redirect
3910 $skin: Skin object
3911 &$link: HTML link to title
3912
3913 'WebRequestPathInfoRouter': While building the PathRouter to parse the
3914 REQUEST_URI.
3915 $router: The PathRouter instance
3916
3917 'WebResponseSetCookie': when setting a cookie in WebResponse::setcookie().
3918 Return false to prevent setting of the cookie.
3919 &$name: Cookie name passed to WebResponse::setcookie()
3920 &$value: Cookie value passed to WebResponse::setcookie()
3921 &$expire: Cookie expiration, as for PHP's setcookie()
3922 &$options: Options passed to WebResponse::setcookie()
3923
3924 'wfShellWikiCmd': Called when generating a shell-escaped command line string to
3925 run a MediaWiki cli script.
3926 &$script: MediaWiki cli script path
3927 &$parameters: Array of arguments and options to the script
3928 &$options: Associative array of options, may contain the 'php' and 'wrapper'
3929 keys
3930
3931 'wgQueryPages': Called when initialising list of QueryPage subclasses, use this
3932 to add new query pages to be updated with maintenance/updateSpecialPages.php.
3933 &$qp: The list of QueryPages
3934
3935 'WhatLinksHereProps': Allows annotations to be added to WhatLinksHere
3936 $row: The DB row of the entry.
3937 $title: The Title of the page where the link comes FROM
3938 $target: The Title of the page where the link goes TO
3939 &$props: Array of HTML strings to display after the title.
3940
3941 'WikiExporter::dumpStableQuery': Get the SELECT query for "stable" revisions
3942 dumps. One, and only one hook should set this, and return false.
3943 &$tables: Database tables to use in the SELECT query
3944 &$opts: Options to use for the query
3945 &$join: Join conditions
3946
3947 'WikiPageDeletionUpdates': DEPRECATED! Use PageDeletionDataUpdates or
3948 override ContentHandler::getDeletionDataUpdates instead.
3949 Manipulates the list of DeferrableUpdates to be applied when a page is deleted.
3950 $page: the WikiPage
3951 $content: the Content to generate updates for, or null in case the page revision
3952 could not be loaded. The delete will succeed despite this.
3953 &$updates: the array of objects that implement DeferrableUpdate. Hook function
3954 may want to add to it.
3955
3956 'WikiPageFactory': Override WikiPage class used for a title
3957 $title: Title of the page
3958 &$page: Variable to set the created WikiPage to.
3959
3960 'XmlDumpWriterOpenPage': Called at the end of XmlDumpWriter::openPage, to allow
3961 extra metadata to be added.
3962 $obj: The XmlDumpWriter object.
3963 &$out: The output string.
3964 $row: The database row for the page.
3965 $title: The title of the page.
3966
3967 'XmlDumpWriterWriteRevision': Called at the end of a revision in an XML dump, to
3968 add extra metadata.
3969 &$obj: The XmlDumpWriter object.
3970 &$out: The text being output.
3971 $row: The database row for the revision.
3972 $text: The revision text.
3973
3974 More hooks might be available but undocumented, you can execute
3975 "php maintenance/findHooks.php" to find hidden ones.