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