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