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