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.
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', 'ArticleSave', 'ArticleSaveComplete',
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.
21 The function part of a hook.
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.
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):
37 function showAnArticle($article) {
38 global $wgReverseTitle, $wgCapitalizeTitle;
40 if ($wgReverseTitle) {
41 wfReverseTitle($article);
44 if ($wgCapitalizeTitle) {
45 wfCapitalizeTitle($article);
48 # code to actually show the article goes here
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:
55 function showAnArticle($article) {
56 global $wgReverseTitle, $wgCapitalizeTitle, $wgNotifyArticle;
58 if ($wgReverseTitle) {
59 wfReverseTitle($article);
62 if ($wgCapitalizeTitle) {
63 wfCapitalizeTitle($article);
66 # code to actually show the article goes here
68 if ($wgNotifyArticle) {
69 wfNotifyArticleShow($article));
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:
76 function showAnArticle($article) {
78 if (wfRunHooks('ArticleShow', array(&$article))) {
80 # code to actually show the article goes here
82 wfRunHooks('ArticleShowComplete', array(&$article));
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.
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
96 function reverseArticleTitle($article) {
100 function reverseForExport($article) {
104 The setup function for the extension just has to add its hook functions to the
107 setupTitleReversingExtension() {
110 $wgHooks['ArticleShow'][] = 'reverseArticleTitle';
111 $wgHooks['ArticleDelete'][] = 'reverseArticleTitle';
112 $wgHooks['ArticleExport'][] = 'reverseForExport';
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.
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:
123 require_once('extensions/ReverseTitle.php');
125 ...to their LocalSettings.php file; those of us who don't want or need it can
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.
133 A hook is a chunk of code run at some particular event. It consists of:
135 * a function with some optional accompanying data, or
136 * an object with a method and some optional accompanying data.
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:
141 $wgHooks['EventName'][] = 'someFunction'; # function, no data
142 $wgHooks['EventName'][] = array('someFunction', $someData);
143 $wgHooks['EventName'][] = array('someFunction'); # weird, but OK
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
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:
155 someFunction($param1, $param2)
157 someFunction($someData, $param1, $param2)
160 $object->onEventName($param1, $param2)
162 $object->someMethod($param1, $param2)
163 # object with method and data
164 $object->someMethod($someData, $param1, $param2)
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.
170 The extra data is useful if we want to use the same function or object for
171 different purposes. For example:
173 $wgHooks['ArticleSaveComplete'][] = array('ircNotify', 'TimStarling');
174 $wgHooks['ArticleSaveComplete'][] = array('ircNotify', 'brion');
176 This code would result in ircNotify being run twice when an article is saved:
177 once for 'TimStarling', and once for 'brion'.
179 Hooks can return three possible values:
181 * true: the hook has operated successfully
182 * "some string": an error occurred; processing should stop and the error
183 should be shown to the user
184 * false: the hook has successfully done the work necessary and the calling
187 The last result would be for cases where the hook function replaces the main
188 functionality. For example, if you wanted to authenticate users to a custom
189 system (LDAP, another PHP program, whatever), you could do:
191 $wgHooks['UserLogin'][] = array('ldapLogin', $ldapServer);
193 function ldapLogin($username, $password) {
198 Returning false makes less sense for events where the action is complete, and
199 will normally be ignored.
201 Note that none of the examples made use of create_function() as a way to
202 attach a function to a hook. This is known to cause problems (notably with
203 Special:Version), and should be avoided when at all possible.
207 A calling function or method uses the wfRunHooks() function to run the hooks
208 related to a particular event, like so:
214 if (wfRunHooks('ArticleProtect', array(&$this, &$wgUser))) {
215 # protect the article
216 wfRunHooks('ArticleProtectComplete', array(&$this, &$wgUser));
221 wfRunHooks() returns true if the calling function should continue processing
222 (the hooks ran OK, or there are no hooks to run), or false if it shouldn't (an
223 error occurred, or one of the hooks handled the action already). Checking the
224 return value matters more for "before" hooks than for "complete" hooks.
226 Note that hook parameters are passed in an array; this is a necessary
227 inconvenience to make it possible to pass reference values (that can be changed)
228 into the hook code. Also note that earlier versions of wfRunHooks took a
229 variable number of arguments; the array() calling protocol came about after
232 ==Events and parameters==
234 This is a list of known events and parameters; please add to it if you're going
235 to add events to the MediaWiki code.
237 'AbortAutoAccount': Return false to cancel automated local account creation,
238 where normally authentication against an external auth plugin would be creating
240 $user: the User object about to be created (read-only, incomplete)
241 &$abortMsg: out parameter: name of error message to be displayed to user
243 'AbortAutoblock': Return false to cancel an autoblock.
244 $autoblockip: The IP going to be autoblocked.
245 $block: The block from which the autoblock is coming.
247 'AbortDiffCache': Can be used to cancel the caching of a diff.
248 &$diffEngine: DifferenceEngine object
250 'AbortEmailNotification': Can be used to cancel email notifications for an edit.
251 $editor: The User who made the change.
252 $title: The Title of the page that was edited.
254 'AbortLogin': Return false to cancel account login.
255 $user: the User object being authenticated against
256 $password: the password being submitted, not yet checked for validity
257 &$retval: a LoginForm class constant to return from authenticateUserData();
258 default is LoginForm::ABORTED. Note that the client may be using
259 a machine API rather than the HTML user interface.
260 &$msg: the message identifier for abort reason (new in 1.18, not available before 1.18)
262 'AbortMove': Allows to abort moving an article (title).
265 $user: user who is doing the move
267 $reason: the reason for the move (added in 1.13)
269 'AbortNewAccount': Return false to cancel explicit account creation.
270 $user: the User object about to be created (read-only, incomplete)
271 &$msg: out parameter: HTML to display on abort
273 'ActionBeforeFormDisplay': Before executing the HTMLForm object.
274 $name: name of the action
275 &$form: HTMLForm object
276 $article: Article object
278 'ActionModifyFormFields': Before creating an HTMLForm object for a page action;
279 Allows to change the fields on the form that will be generated.
280 $name: name of the action
281 &$fields: HTMLForm descriptor array
282 $article: Article object
284 'AddNewAccount': After a user account is created.
285 $user: the User object that was created. (Parameter added in 1.7)
286 $byEmail: true when account was created "by email" (added in 1.12)
288 'AfterFinalPageOutput': At the end of OutputPage::output() but before final
289 ob_end_flush() which will send the buffered output to the client. This allows
290 for last-minute modification of the output within the buffer by using
292 &$output: OutputPage object
294 'AfterImportPage': When a page import is completed.
295 $title: Title under which the revisions were imported
296 $origTitle: Title provided by the XML file
297 $revCount: Number of revisions in the XML file
298 $sRevCount: Number of successfully imported revisions
299 $pageInfo: associative array of page information
301 'AfterFinalPageOutput': Nearly at the end of OutputPage::output() but
302 before OutputPage::sendCacheControl() and final ob_end_flush() which
303 will send the buffered output to the client. This allows for last-minute
304 modification of the output within the buffer by using ob_get_clean().
305 $output: The OutputPage object where output() was called
307 'AjaxAddScript': Called in output page just before the initialisation
308 of the javascript ajax engine. The hook is only called when ajax
309 is enabled ( $wgUseAjax = true; ).
310 &$output: OutputPage object
312 'AlternateEdit': Before checking if a user can edit a page and before showing
313 the edit form ( EditPage::edit() ). This is triggered on &action=edit.
314 $editPage: the EditPage object
316 'AlternateEditPreview': Before generating the preview of the page when editing
317 ( EditPage::getPreviewText() ).
318 $editPage: the EditPage object
319 &$content: the Content object for the text field from the edit page
320 &$previewHTML: Text to be placed into the page for the preview
321 &$parserOutput: the ParserOutput object for the preview
322 return false and set $previewHTML and $parserOutput to output custom page
325 'AlternateUserMailer': Called before mail is sent so that mail could be logged
326 (or something else) instead of using PEAR or PHP's mail(). Return false to skip
327 the regular method of sending mail. Return a string to return a php-mail-error
328 message containing the error. Returning true will continue with sending email
330 $headers: Associative array of headers for the email
331 $to: MailAddress object or array
333 $subject: Subject of the email
334 $body: Body of the message
336 'APIAfterExecute': After calling the execute() method of an API module. Use
337 this to extend core API modules.
338 &$module: Module object
340 'ApiCheckCanExecute': Called during ApiMain::checkCanExecute. Use to further
341 authenticate and authorize API clients before executing the module. Return
342 false and set a message to cancel the request.
343 $module: Module object
345 &$message: API usage message to die with, as a message key or array
346 as accepted by ApiBase::dieUsageMsg.
348 'APIEditBeforeSave': Before saving a page with api.php?action=edit, after
349 processing request parameters. Return false to let the request fail, returning
350 an error message or an <edit result="Failure"> tag if $resultArr was filled.
351 $editPage : the EditPage object
352 $text : the new text of the article (has yet to be saved)
353 &$resultArr : data in this array will be added to the API result
355 'APIGetAllowedParams': Use this hook to modify a module's parameters.
356 &$module: ApiBase Module object
357 &$params: Array of parameters
358 $flags: int zero or OR-ed flags like ApiBase::GET_VALUES_FOR_HELP
360 'APIGetDescription': Use this hook to modify a module's description.
361 &$module: ApiBase Module object
362 &$desc: Array of descriptions
364 'APIGetParamDescription': Use this hook to modify a module's parameter
366 &$module: ApiBase Module object
367 &$desc: Array of parameter descriptions
369 'APIGetResultProperties': Use this hook to modify the properties in a module's
371 &$module: ApiBase Module object
372 &$properties: Array of properties
374 'APIQueryAfterExecute': After calling the execute() method of an
375 action=query submodule. Use this to extend core API modules.
376 &$module: Module object
378 'APIQueryGeneratorAfterExecute': After calling the executeGenerator() method of
379 an action=query submodule. Use this to extend core API modules.
380 &$module: Module object
381 &$resultPageSet: ApiPageSet object
383 'APIQueryInfoTokens': Use this hook to add custom tokens to prop=info. Every
384 token has an action, which will be used in the intoken parameter and in the
385 output (actiontoken="..."), and a callback function which should return the
386 token, or false if the user isn't allowed to obtain it. The prototype of the
387 callback function is func($pageid, $title), where $pageid is the page ID of the
388 page the token is requested for and $title is the associated Title object. In
389 the hook, just add your callback to the $tokenFunctions array and return true
390 (returning false makes no sense).
391 $tokenFunctions: array(action => callback)
393 'APIQueryRevisionsTokens': Use this hook to add custom tokens to prop=revisions.
394 Every token has an action, which will be used in the rvtoken parameter and in
395 the output (actiontoken="..."), and a callback function which should return the
396 token, or false if the user isn't allowed to obtain it. The prototype of the
397 callback function is func($pageid, $title, $rev), where $pageid is the page ID
398 of the page associated to the revision the token is requested for, $title the
399 associated Title object and $rev the associated Revision object. In the hook,
400 just add your callback to the $tokenFunctions array and return true (returning
401 false makes no sense).
402 $tokenFunctions: array(action => callback)
404 'APIQueryRecentChangesTokens': Use this hook to add custom tokens to
405 list=recentchanges. Every token has an action, which will be used in the rctoken
406 parameter and in the output (actiontoken="..."), and a callback function which
407 should return the token, or false if the user isn't allowed to obtain it. The
408 prototype of the callback function is func($pageid, $title, $rc), where $pageid
409 is the page ID of the page associated to the revision the token is requested
410 for, $title the associated Title object and $rc the associated RecentChange
411 object. In the hook, just add your callback to the $tokenFunctions array and
412 return true (returning false makes no sense).
413 $tokenFunctions: array(action => callback)
415 'APIQuerySiteInfoGeneralInfo': Use this hook to add extra information to the
416 sites general information.
417 $module: the current ApiQuerySiteInfo module
418 &$results: array of results, add things here
420 'APIQueryUsersTokens': Use this hook to add custom token to list=users. Every
421 token has an action, which will be used in the ustoken parameter and in the
422 output (actiontoken="..."), and a callback function which should return the
423 token, or false if the user isn't allowed to obtain it. The prototype of the
424 callback function is func($user) where $user is the User object. In the hook,
425 just add your callback to the $tokenFunctions array and return true (returning
426 false makes no sense).
427 $tokenFunctions: array(action => callback)
429 'ApiMain::onException': Called by ApiMain::executeActionWithErrorHandling() when
430 an exception is thrown during API action execution.
431 $apiMain: Calling ApiMain instance.
432 $e: Exception object.
434 'ApiRsdServiceApis': Add or remove APIs from the RSD services list. Each service
435 should have its own entry in the $apis array and have a unique name, passed as
436 key for the array that represents the service data. In this data array, the
437 key-value-pair identified by the apiLink key is required.
438 &$apis: array of services
440 'ApiTokensGetTokenTypes': Use this hook to extend action=tokens with new token
442 &$tokenTypes: supported token types in format 'type' => callback function
443 used to retrieve this type of tokens.
445 'ArticleAfterFetchContent': After fetching content of an article from the
446 database. DEPRECATED, use ArticleAfterFetchContentObject instead.
447 $article: the article (object) being loaded from the database
448 &$content: the content (string) of the article
450 'ArticleAfterFetchContentObject': After fetching content of an article from the
452 $article: the article (object) being loaded from the database
453 &$content: the content of the article, as a Content object
455 'ArticleConfirmDelete': Before writing the confirmation form for article
457 $article: the article (object) being deleted
458 $output: the OutputPage object
459 &$reason: the reason (string) the article is being deleted
461 'ArticleContentOnDiff': Before showing the article content below a diff. Use
462 this to change the content in this area or how it is loaded.
463 $diffEngine: the DifferenceEngine
464 $output: the OutputPage object
466 'ArticleDelete': Before an article is deleted.
467 $wikiPage: the WikiPage (object) being deleted
468 $user: the user (object) deleting the article
469 $reason: the reason (string) the article is being deleted
470 $error: if the deletion was prohibited, the (raw HTML) error message to display
472 $status: Status object, modify this to throw an error. Overridden by $error
475 'ArticleDeleteComplete': After an article is deleted.
476 $wikiPage: the WikiPage that was deleted
477 $user: the user that deleted the article
478 $reason: the reason the article was deleted
479 $id: id of the article that was deleted
480 $content: the Content of the deleted page
481 $logEntry: the ManualLogEntry used to record the deletion
483 'ArticleEditUpdateNewTalk': Before updating user_newtalk when a user talk page
485 &$wikiPage: WikiPage (object) of the user talk page
486 $recipient: User (object) who's talk page was edited
488 'ArticleEditUpdates': When edit updates (mainly link tracking) are made when an
489 article has been changed.
490 $wikiPage: the WikiPage (object)
491 $editInfo: data holder that includes the parser output ($editInfo->output) for
492 that page after the change
493 $changed: bool for if the page was changed
495 'ArticleEditUpdatesDeleteFromRecentchanges': Before deleting old entries from
496 recentchanges table, return false to not delete old entries.
497 $wikiPage: WikiPage (object) being modified
499 'ArticleFromTitle': when creating an article object from a title object using
500 Wiki::articleFromTitle().
501 $title: Title (object) used to create the article object
502 $article: Article (object) that will be returned
504 'ArticleInsertComplete': After a new article is created. DEPRECATED, use
505 PageContentInsertComplete.
506 $wikiPage: WikiPage created
507 $user: User creating the article
509 $summary: Edit summary/comment
510 $isMinor: Whether or not the edit was marked as minor
511 $isWatch: (No longer used)
512 $section: (No longer used)
513 $flags: Flags passed to WikiPage::doEditContent()
514 $revision: New Revision of the article
516 'ArticleMergeComplete': After merging to article using Special:Mergehistory.
517 $targetTitle: target title (object)
518 $destTitle: destination title (object)
520 'ArticlePageDataAfter': After loading data of an article from the database.
521 $wikiPage: WikiPage (object) whose data were loaded
522 $row: row (object) returned from the database server
524 'ArticlePageDataBefore': Before loading data of an article from the database.
525 $wikiPage: WikiPage (object) that data will be loaded
526 $fields: fields (array) to load from the database
528 'ArticlePrepareTextForEdit': Called when preparing text to be saved.
529 $wikiPage: the WikiPage being saved
530 $popts: parser options to be used for pre-save transformation
532 'ArticleProtect': Before an article is protected.
533 $wikiPage: the WikiPage being protected
534 $user: the user doing the protection
535 $protect: boolean whether this is a protect or an unprotect
536 $reason: Reason for protect
537 $moveonly: boolean whether this is for move only or not
539 'ArticleProtectComplete': After an article is protected.
540 $wikiPage: the WikiPage that was protected
541 $user: the user who did the protection
542 $protect: boolean whether it was a protect or an unprotect
543 $reason: Reason for protect
544 $moveonly: boolean whether it was for move only or not
546 'ArticlePurge': Before executing "&action=purge".
547 $wikiPage: WikiPage (object) to purge
549 'ArticleRevisionVisibilitySet': Called when changing visibility of one or more
550 revisions of an article.
551 &$title: Title object of the article
553 'ArticleRevisionUndeleted': After an article revision is restored.
554 $title: the article title
555 $revision: the revision
556 $oldPageID: the page ID of the revision when archived (may be null)
558 'ArticleRollbackComplete': After an article rollback is completed.
559 $wikiPage: the WikiPage that was edited
560 $user: the user who did the rollback
561 $revision: the revision the page was reverted back to
562 $current: the reverted revision
564 'ArticleSave': Before an article is saved. DEPRECATED, use PageContentSave
566 $wikiPage: the WikiPage (object) being saved
567 $user: the user (object) saving the article
568 $text: the new article text
569 $summary: the article summary (comment)
574 'ArticleSaveComplete': After an article has been updated. DEPRECATED, use
575 PageContentSaveComplete instead.
576 $wikiPage: WikiPage modified
577 $user: User performing the modification
579 $summary: Edit summary/comment
580 $isMinor: Whether or not the edit was marked as minor
581 $isWatch: (No longer used)
582 $section: (No longer used)
583 $flags: Flags passed to WikiPage::doEditContent()
584 $revision: New Revision of the article
585 $status: Status object about to be returned by doEditContent()
586 $baseRevId: the rev ID (or false) this edit was based on
588 'ArticleUndelete': When one or more revisions of an article are restored.
589 $title: Title corresponding to the article restored
590 $create: Whether or not the restoration caused the page to be created (i.e. it
591 didn't exist before).
592 $comment: The comment associated with the undeletion.
594 'ArticleUndeleteLogEntry': When a log entry is generated but not yet saved.
595 $pageArchive: the PageArchive object
596 &$logEntry: ManualLogEntry object
597 $user: User who is performing the log action
599 'ArticleUpdateBeforeRedirect': After a page is updated (usually on save), before
600 the user is redirected back to the page.
601 &$article: the article
602 &$sectionanchor: The section anchor link (e.g. "#overview" )
603 &$extraq: Extra query parameters which can be added via hooked functions
605 'ArticleViewFooter': After showing the footer section of an ordinary page view
606 $article: Article object
608 'ArticleViewHeader': Before the parser cache is about to be tried for article
610 &$article: the article
611 &$pcache: whether to try the parser cache or not
612 &$outputDone: whether the output for this page finished or not. Set to a ParserOutput
613 object to both indicate that the output is done and what parser output was used.
615 'ArticleViewRedirect': Before setting "Redirected from ..." subtitle when a
616 redirect was followed.
617 $article: target article (object)
619 'ArticleViewCustom': Allows to output the text of the article in a different
620 format than wikitext. DEPRECATED, use ArticleContentViewCustom instead. Note
621 that it is preferable to implement proper handing for a custom data type using
622 the ContentHandler facility.
623 $text: text of the page
624 $title: title of the page
625 $output: reference to $wgOut
627 'ArticleContentViewCustom': Allows to output the text of the article in a
628 different format than wikitext. Note that it is preferable to implement proper
629 handing for a custom data type using the ContentHandler facility.
630 $content: content of the page, as a Content object
631 $title: title of the page
632 $output: reference to $wgOut
634 'AuthPluginAutoCreate': Called when creating a local account for an user logged
635 in from an external authentication method.
636 $user: User object created locally
638 'AuthPluginSetup': Update or replace authentication plugin object ($wgAuth).
639 Gives a chance for an extension to set it programmatically to a variable class.
640 &$auth: the $wgAuth object, probably a stub
642 'AutopromoteCondition': Check autopromote condition for user.
643 $type: condition type
646 $result: result of checking autopromote condition
648 'BacklinkCacheGetPrefix': Allows to set prefix for a specific link table.
652 'BacklinkCacheGetConditions': Allows to set conditions for query when links to
653 certain title are fetched.
655 $title: title of the page to which backlinks are sought
656 &$conds: query conditions
658 'BadImage': When checking against the bad image list. Change $bad and return
659 false to override. If an image is "bad", it is not rendered inline in wiki
660 pages or galleries in category pages.
661 $name: Image name being checked
662 &$bad: Whether or not the image is "bad"
664 'BeforeDisplayNoArticleText': Before displaying message key "noarticletext" or
665 "noarticletext-nopermission" at Article::showMissingArticle().
666 $article: article object
668 'BeforeInitialize': Before anything is initialized in
669 MediaWiki::performRequest().
670 &$title: Title being used for request
672 &$output: OutputPage object
674 $request: WebRequest object
675 $mediaWiki: Mediawiki object
677 'BeforePageDisplay': Prior to outputting a page.
678 &$out: OutputPage object
681 'BeforePageRedirect': Prior to sending an HTTP redirect. Gives a chance to
682 override how the redirect is output by modifying, or by returning false and
683 taking over the output.
684 $out: OutputPage object
685 &$redirect: URL, modifiable
686 &$code: HTTP code (eg '301' or '302'), modifiable
688 'BeforeParserFetchFileAndTitle': Before an image is rendered by Parser.
689 $parser: Parser object
691 &$options: array of options to RepoGroup::findFile
692 &$descQuery: query string to add to thumbnail URL
694 FIXME: Where does the below sentence fit in?
695 If 'broken' is a key in $options then the file will appear as a broken thumbnail.
697 'BeforeParserFetchTemplateAndtitle': Before a template is fetched by Parser.
698 $parser: Parser object
699 $title: title of the template
700 &$skip: skip this template and link it?
701 &$id: the id of the revision being parsed
703 'BeforeParserrenderImageGallery': Before an image gallery is rendered by Parser.
704 &$parser: Parser object
705 &$ig: ImageGallery object
707 'BeforeWelcomeCreation': Before the welcomecreation message is displayed to a
709 &$welcome_creation_msg: MediaWiki message name to display on the welcome screen
710 to a newly created user account.
711 &$injected_html: Any HTML to inject after the "logged in" message of a newly
714 'BitmapHandlerTransform': before a file is transformed, gives extension the
715 possibility to transform it themselves
716 $handler: BitmapHandler
718 &$scalerParams: Array with scaler parameters
719 &$mto: null, set to a MediaTransformOutput
721 'BitmapHandlerCheckImageArea': By BitmapHandler::normaliseParams, after all
722 normalizations have been performed, except for the $wgMaxImageArea check.
724 &$params: Array of parameters
725 &$checkImageAreaHookResult: null, set to true or false to override the
726 $wgMaxImageArea check result.
728 'PerformRetroactiveAutoblock': Called before a retroactive autoblock is applied
730 $block: Block object (which is set to be autoblocking)
731 &$blockIds: Array of block IDs of the autoblock
733 'BlockIp': Before an IP address or user is blocked.
734 $block: the Block object about to be saved
735 $user: the user _doing_ the block (not the one being blocked)
737 'BlockIpComplete': After an IP address or user is blocked.
738 $block: the Block object that was saved
739 $user: the user who did the block (not the one being blocked)
741 'BookInformation': Before information output on Special:Booksources.
742 $isbn: ISBN to show information for
743 $output: OutputPage object in use
745 'CanonicalNamespaces': For extensions adding their own namespaces or altering
747 &$namespaces: Array of namespace numbers with corresponding canonical names
749 'CategoryAfterPageAdded': After a page is added to a category.
750 $category: Category that page was added to
751 $wikiPage: WikiPage that was added
753 'CategoryAfterPageRemoved': After a page is removed from a category.
754 $category: Category that page was removed from
755 $wikiPage: WikiPage that was removed
757 'CategoryPageView': Before viewing a categorypage in CategoryPage::view.
758 $catpage: CategoryPage instance
760 'ChangePasswordForm': For extensions that need to add a field to the
761 ChangePassword form via the Preferences form.
762 &$extraFields: An array of arrays that hold fields like would be passed to the
765 'ChangesListInsertArticleLink': Override or augment link to article in RC list.
766 &$changesList: ChangesList instance.
767 &$articlelink: HTML of link to article (already filled-in).
768 &$s: HTML of row that is being constructed.
769 &$rc: RecentChange instance.
770 $unpatrolled: Whether or not we are showing unpatrolled changes.
771 $watched: Whether or not the change is watched by the user.
773 'Collation::factory': Called if $wgCategoryCollation is an unknown collation.
774 $collationName: Name of the collation in question
775 &$collationObject: Null. Replace with a subclass of the Collation class that
776 implements the collation given in $collationName.
778 'ConfirmEmailComplete': Called after a user's email has been confirmed
780 $user: user (object) whose email is being confirmed
782 'ContentHandlerDefaultModelFor': Called when the default content model is determined
783 for a given title. May be used to assign a different model for that title.
784 $title: the Title in question
785 &$model: the model name. Use with CONTENT_MODEL_XXX constants.
787 'ContentHandlerForModelID': Called when a ContentHandler is requested for a given
788 content model name, but no entry for that model exists in $wgContentHandlers.
789 $modeName: the requested content model name
790 &$handler: set this to a ContentHandler object, if desired.
792 'ConvertContent': Called by AbstractContent::convert when a conversion to another
793 content model is requested.
794 $content: The Content object to be converted.
795 $toModel: The ID of the content model to convert to.
796 $lossy: boolean indicating whether lossy conversion is allowed.
797 &$result: Output parameter, in case the handler function wants to provide a
798 converted Content object. Note that $result->getContentModel() must return $toModel.
799 Handler functions that modify $result should generally return false to further
800 attempts at conversion.
802 'ContribsPager::getQueryInfo': Before the contributions query is about to run
803 &$pager: Pager object for contributions
804 &$queryInfo: The query for the contribs Pager
806 'ContribsPager::reallyDoQuery': Called before really executing the query for My Contributions
807 &$data: an array of results of all contribs queries
808 $pager: The ContribsPager object hooked into
809 $offset: Index offset, inclusive
810 $limit: Exact query limit
811 $descending: Query direction, false for ascending, true for descending
813 'ContributionsLineEnding': Called before a contributions HTML line is finished
814 $page: SpecialPage object for contributions
816 $row: the DB row for this line
817 &$classes: the classes to add to the surrounding <li>
819 'ContributionsToolLinks': Change tool links above Special:Contributions
821 $title: User page title
822 &$tools: Array of tool links
824 'CustomEditor': When invoking the page editor
825 $article: Article being edited
826 $user: User performing the edit
828 Return true to allow the normal editor to be used, or false
829 if implementing a custom editor, e.g. for a special namespace,
832 'DatabaseOraclePostInit': Called after initialising an Oracle database
833 &$db: the DatabaseOracle object
835 'Debug': Called when outputting a debug log line via wfDebug() or wfDebugLog()
836 $text: plaintext string to be output
837 $group: null or a string naming a logging group (as defined in $wgDebugLogGroups)
839 'NewDifferenceEngine': Called when a new DifferenceEngine object is made
840 $title: the diff page title (nullable)
841 &$oldId: the actual old Id to use in the diff
842 &$newId: the actual new Id to use in the diff (0 means current)
843 $old: the ?old= param value from the url
844 $new: the ?new= param value from the url
846 'DiffRevisionTools': Override or extend the revision tools available from the
847 diff view, i.e. undo, etc.
848 $rev: Revision object
849 &$links: Array of HTML links
851 'DiffViewHeader': Called before diff display
852 $diff: DifferenceEngine object that's calling
853 $oldRev: Revision object of the "old" revision (may be null/invalid)
854 $newRev: Revision object of the "new" revision
856 'DisplayOldSubtitle': before creating subtitle when browsing old versions of
858 $article: article (object) being viewed
859 $oldid: oldid (int) being viewed
861 'DoEditSectionLink': Override the HTML generated for section edit links
862 $skin: Skin object rendering the UI
863 $title: Title object for the title being linked to (may not be the same as
864 $wgTitle, if the section is included from a template)
865 $section: The designation of the section being pointed to, to be included in
866 the link, like "§ion=$section"
867 $tooltip: The default tooltip. Escape before using.
868 By default, this is wrapped in the 'editsectionhint' message.
869 &$result: The HTML to return, prefilled with the default plus whatever other
870 changes earlier hooks have made
871 $lang: The language code to use for the link in the wfMessage function
873 'EditFilter': Perform checks on an edit
874 $editor: EditPage instance (object). The edit form (see includes/EditPage.php)
875 $text: Contents of the edit box
876 $section: Section being edited
877 &$error: Error message to return
878 $summary: Edit summary for page
880 'EditFilterMerged': Post-section-merge edit filter.
881 DEPRECATED, use EditFilterMergedContent instead.
882 $editor: EditPage instance (object)
883 $text: content of the edit box
884 &$error: error message to return
885 $summary: Edit summary for page
887 'EditFilterMergedContent': Post-section-merge edit filter.
888 This may be triggered by the EditPage or any other facility that modifies page content.
889 Use the $status object to indicate whether the edit should be allowed, and to provide
890 a reason for disallowing it. Return false to abort the edit, and true to continue.
891 Returning true if $status->isOK() returns false means "don't save but continue user
892 interaction", e.g. show the edit form.
893 $context: object implementing the IContextSource interface.
894 $content: content of the edit box, as a Content object.
895 $status: Status object to represent errors, etc.
896 $summary: Edit summary for page
897 $user: the User object representing the user whois performing the edit.
898 $minoredit: whether the edit was marked as minor by the user.
900 'EditFormPreloadText': Allows population of the edit form when creating
902 &$text: Text to preload with
903 &$title: Title object representing the page being created
905 'EditFormInitialText': Allows modifying the edit form when editing existing
907 $editPage: EditPage object
909 'EditPage::attemptSave': Called before an article is
910 saved, that is before WikiPage::doEditContent() is called
911 $editpage_Obj: the current EditPage object
913 'EditPage::importFormData': allow extensions to read additional data
915 $editpage: EditPage instance
917 return value is ignored (should always return true)
919 'EditPage::showEditForm:fields': allows injection of form field into edit form
920 $editor: the EditPage instance for reference
921 $out: an OutputPage instance to write to
922 return value is ignored (should always return true)
924 'EditPage::showEditForm:initial': before showing the edit form
925 $editor: EditPage instance (object)
926 $out: an OutputPage instance to write to
928 Return false to halt editing; you'll need to handle error messages, etc.
929 yourself. Alternatively, modifying $error and returning true will cause the
930 contents of $error to be echoed at the top of the edit form as wikitext.
931 Return true without altering $error to allow the edit to proceed.
933 'EditPage::showStandardInputs:options': allows injection of form fields into
935 $editor: EditPage instance (object)
936 $out: an OutputPage instance to write to
937 &$tabindex: HTML tabindex of the last edit check/button
938 return value is ignored (should always be true)
940 'EditPageBeforeConflictDiff': allows modifying the EditPage object and output
941 when there's an edit conflict. Return false to halt normal diff output; in
942 this case you're responsible for computing and outputting the entire "conflict"
943 part, i.e., the "difference between revisions" and "your text" headers and
945 &$editor: EditPage instance
946 &$out: OutputPage instance
948 'EditPageBeforeEditButtons': Allows modifying the edit buttons below the
949 textarea in the edit form.
950 &$editpage: The current EditPage object
951 &$buttons: Array of edit buttons "Save", "Preview", "Live", and "Diff"
952 &$tabindex: HTML tabindex of the last edit check/button
954 'EditPageBeforeEditChecks': Allows modifying the edit checks below the textarea
956 &$editpage: The current EditPage object
957 &$checks: Array of edit checks like "watch this page"/"minor edit"
958 &$tabindex: HTML tabindex of the last edit check/button
960 'EditPageBeforeEditToolbar': Allows modifying the edit toolbar above the
961 textarea in the edit form.
962 &$toolbar: The toolbar HTMl
964 'EditPageCopyrightWarning': Allow for site and per-namespace customization of
965 contribution/copyright notice.
966 $title: title of page being edited
967 &$msg: localization message name, overridable. Default is either
968 'copyrightwarning' or 'copyrightwarning2'.
970 'EditPageGetDiffText': DEPRECATED. Use EditPageGetDiffContent instead. Allow
971 modifying the wikitext that will be used in "Show changes". Note that it is
972 preferable to implement diff handling for different data types using the
973 ContentHandler facility.
974 $editPage: EditPage object
975 &$newtext: wikitext that will be used as "your version"
977 'EditPageGetDiffContent': Allow modifying the wikitext that will be used in
978 "Show changes". Note that it is preferable to implement diff handling for
979 different data types using the ContentHandler facility.
980 $editPage: EditPage object
981 &$newtext: wikitext that will be used as "your version"
983 'EditPageGetPreviewText': DEPRECATED. Use EditPageGetPreviewContent instead.
984 Allow modifying the wikitext that will be previewed. Note that it is preferable
985 to implement previews for different data types using the ContentHandler
987 $editPage: EditPage object
988 &$toparse: wikitext that will be parsed
990 'EditPageGetPreviewContent': Allow modifying the wikitext that will be
991 previewed. Note that it is preferable to implement previews for different data
992 types using the ContentHandler facility.
993 $editPage: EditPage object
994 &$content: Content object to be previewed (may be replaced by hook function)
996 'EditPageNoSuchSection': When a section edit request is given for an non-existent section
997 &$editpage: The current EditPage object
998 &$res: the HTML of the error text
1000 'EditPageTosSummary': Give a chance for site and per-namespace customizations
1001 of terms of service summary link that might exist separately from the copyright
1003 $title: title of page being edited
1004 &$msg: localization message name, overridable. Default is 'editpage-tos-summary'
1006 'EditSectionLink': Do not use, use DoEditSectionLink instead.
1007 $skin: Skin rendering the UI
1008 $title: Title being linked to
1009 $section: Section to link to
1011 &$result: Result (alter this to override the generated links)
1012 $lang: The language code to use for the link in the wfMessage function
1014 'EmailConfirmed': When checking that the user's email address is "confirmed".
1015 $user: User being checked
1016 $confirmed: Whether or not the email address is confirmed
1017 This runs before the other checks, such as anonymity and the real check; return
1018 true to allow those checks to occur, and false if checking is done.
1020 'EmailUser': Before sending email from one user to another.
1021 $to: address of receiving user
1022 $from: address of sending user
1023 $subject: subject of the mail
1024 $text: text of the mail
1026 'EmailUserCC': Before sending the copy of the email to the author.
1027 $to: address of receiving user
1028 $from: address of sending user
1029 $subject: subject of the mail
1030 $text: text of the mail
1032 'EmailUserComplete': After sending email from one user to another.
1033 $to: address of receiving user
1034 $from: address of sending user
1035 $subject: subject of the mail
1036 $text: text of the mail
1038 'EmailUserForm': After building the email user form object.
1039 $form: HTMLForm object
1041 'EmailUserPermissionsErrors': to retrieve permissions errors for emailing a
1043 $user: The user who is trying to email another user.
1044 $editToken: The user's edit token.
1045 &$hookErr: Out-param for the error. Passed as the parameters to
1046 OutputPage::showErrorPage.
1048 'ExemptFromAccountCreationThrottle': Exemption from the account creation
1050 $ip: The ip address of the user
1052 'ExtensionTypes': Called when generating the extensions credits, use this to
1053 change the tables headers.
1054 &$extTypes: associative array of extensions types
1056 'ExtractThumbParameters': Called when extracting thumbnail parameters from a
1057 thumbnail file name.
1058 $thumbname: the base name of the thumbnail file
1059 &$params: the currently extracted params (has source name, temp or archived zone)
1061 'FetchChangesList': When fetching the ChangesList derivative for a particular
1063 $user: User the list is being fetched for
1064 &$skin: Skin object to be used with the list
1065 &$list: List object (defaults to NULL, change it to an object instance and
1066 return false override the list derivative used)
1068 'FileDeleteComplete': When a file is deleted.
1069 $file: reference to the deleted file
1070 $oldimage: in case of the deletion of an old image, the name of the old file
1071 $article: in case all revisions of the file are deleted a reference to the
1072 WikiFilePage associated with the file.
1073 $user: user who performed the deletion
1076 'FileTransformed': When a file is transformed and moved into storage.
1077 $file: reference to the File object
1078 $thumb: the MediaTransformOutput object
1079 $tmpThumbPath: The temporary file system path of the transformed file
1080 $thumbPath: The permanent storage path of the transformed file
1082 'FileUpload': When a file upload occurs.
1083 $file : Image object representing the file that was uploaded
1084 $reupload : Boolean indicating if there was a previously another image there or
1086 $hasDescription : Boolean indicating that there was already a description page
1087 and a new one from the comment wasn't created (since 1.17)
1089 'FileUndeleteComplete': When a file is undeleted
1090 $title: title object to the file
1091 $fileVersions: array of undeleted versions. Empty if all versions were restored
1092 $user: user who performed the undeletion
1095 'FormatAutocomments': When an autocomment is formatted by the Linker.
1096 &$comment: Reference to the accumulated comment. Initially null, when set the
1097 default code will be skipped.
1098 $pre: Initial part of the parsed comment before the call to the hook.
1099 $auto: The extracted part of the parsed comment before the call to the hook.
1100 $post: The final part of the parsed comment before the call to the hook.
1101 $title: An optional title object used to links to sections. Can be null.
1102 $local: Boolean indicating whether section links should refer to local page.
1104 'GetAutoPromoteGroups': When determining which autopromote groups a user is
1106 &$user: user to promote.
1107 &$promote: groups that will be added.
1109 'GetBlockedStatus': after loading blocking status of an user from the database
1110 $user: user (object) being checked
1112 'GetCacheVaryCookies': Get cookies that should vary cache options.
1113 $out: OutputPage object
1114 &$cookies: array of cookies name, add a value to it if you want to add a cookie
1115 that have to vary cache options
1117 'GetCanonicalURL': Modify fully-qualified URLs used for IRC and e-mail
1119 $title: Title object of page
1120 $url: string value as output (out parameter, can modify)
1121 $query: query options passed to Title::getCanonicalURL()
1123 'GetDefaultSortkey': Override the default sortkey for a page.
1124 $title: Title object that we need to get a sortkey for
1125 &$sortkey: Sortkey to use.
1127 'GetDoubleUnderscoreIDs': Modify the list of behavior switch (double
1128 underscore) magic words. Called by MagicWord.
1129 &$doubleUnderscoreIDs: array of strings
1131 'GetFullURL': Modify fully-qualified URLs used in redirects/export/offsite data.
1132 $title: Title object of page
1133 $url: string value as output (out parameter, can modify)
1134 $query: query options passed to Title::getFullURL()
1136 'GetInternalURL': Modify fully-qualified URLs used for squid cache purging.
1137 $title: Title object of page
1138 $url: string value as output (out parameter, can modify)
1139 $query: query options passed to Title::getInternalURL()
1141 'GetIP': modify the ip of the current user (called only once).
1142 &$ip: string holding the ip as determined so far
1144 'GetLinkColours': modify the CSS class of an array of page links.
1145 $linkcolour_ids: array of prefixed DB keys of the pages linked to,
1147 &$colours: (output) array of CSS classes, indexed by prefixed DB keys
1149 'GetLocalURL': Modify local URLs as output into page links. Note that if you are
1150 working with internal urls (non-interwiki) then it may be preferable to work
1151 with the GetLocalURL::Internal or GetLocalURL::Article hooks as GetLocalURL can
1152 be buggy for internal urls on render if you do not re-implement the horrible
1153 hack that Title::getLocalURL uses in your own extension.
1154 $title: Title object of page
1155 &$url: string value as output (out parameter, can modify)
1156 $query: query options passed to Title::getLocalURL()
1158 'GetLocalURL::Internal': Modify local URLs to internal pages.
1159 $title: Title object of page
1160 &$url: string value as output (out parameter, can modify)
1161 $query: query options passed to Title::getLocalURL()
1163 'GetLocalURL::Article': Modify local URLs specifically pointing to article paths
1164 without any fancy queries or variants.
1165 $title: Title object of page
1166 &$url: string value as output (out parameter, can modify)
1168 'GetMetadataVersion': Modify the image metadata version currently in use. This
1169 is used when requesting image metadata from a ForeignApiRepo. Media handlers
1170 that need to have versioned metadata should add an element to the end of the
1171 version array of the form 'handler_name=version'. Most media handlers won't need
1172 to do this unless they broke backwards compatibility with a previous version of
1173 the media handler metadata output.
1174 &$version: Array of version strings
1176 'GetPreferences': Modify user preferences.
1177 $user: User whose preferences are being modified.
1178 &$preferences: Preferences description array, to be fed to an HTMLForm object
1180 'getUserPermissionsErrors': Add a permissions error when permissions errors are
1181 checked for. Use instead of userCan for most cases. Return false if the user
1182 can't do it, and populate $result with the reason in the form of
1183 array( messagename, param1, param2, ... ). For consistency, error messages
1184 should be plain text with no special coloring, bolding, etc. to show that
1185 they're errors; presenting them properly to the user as errors is done by the
1187 $title: Title object being checked against
1188 $user : Current user object
1189 $action: Action being checked
1190 $result: User permissions error to add. If none, return true.
1192 'getUserPermissionsErrorsExpensive': Equal to getUserPermissionsErrors, but is
1193 called only if expensive checks are enabled. Add a permissions error when
1194 permissions errors are checked for. Return false if the user can't do it, and
1195 populate $result with the reason in the form of array( messagename, param1,
1196 param2, ... ). For consistency, error messages should be plain text with no
1197 special coloring, bolding, etc. to show that they're errors; presenting them
1198 properly to the user as errors is done by the caller.
1200 $title: Title object being checked against
1201 $user : Current user object
1202 $action: Action being checked
1203 $result: User permissions error to add. If none, return true.
1205 'GitViewers': Called when generating the list of git viewers for
1206 Special:Version, use this to change the list.
1207 &$extTypes: associative array of repo URLS to viewer URLs.
1209 'HistoryRevisionTools': Override or extend the revision tools available from the
1210 page history view, i.e. undo, rollback, etc.
1211 $rev: Revision object
1212 &$links: Array of HTML links
1214 'ImageBeforeProduceHTML': Called before producing the HTML created by a wiki
1215 image insertion. You can skip the default logic entirely by returning false, or
1216 just modify a few things using call-by-reference.
1218 &$title: Title object of the image
1219 &$file: File object, or false if it doesn't exist
1220 &$frameParams: Various parameters with special meanings; see documentation in
1221 includes/Linker.php for Linker::makeImageLink
1222 &$handlerParams: Various parameters with special meanings; see documentation in
1223 includes/Linker.php for Linker::makeImageLink
1224 &$time: Timestamp of file in 'YYYYMMDDHHIISS' string form, or false for current
1225 &$res: Final HTML output, used if you return false
1228 'ImageOpenShowImageInlineBefore': Call potential extension just before showing
1229 the image on an image page.
1230 $imagePage: ImagePage object ($this)
1233 'ImagePageAfterImageLinks': Called after the image links section on an image
1235 $imagePage: ImagePage object ($this)
1236 &$html: HTML for the hook to add
1238 'ImagePageFileHistoryLine': Called when a file history line is constructed.
1240 $line: the HTML of the history line
1241 $css: the line CSS class
1243 'ImagePageFindFile': Called when fetching the file associated with an image
1245 $page: ImagePage object
1247 &$displayFile: displayed File object
1249 'ImagePageShowTOC': Called when the file toc on an image page is generated.
1250 $page: ImagePage object
1251 &$toc: Array of <li> strings
1253 'ImgAuthBeforeStream': executed before file is streamed to user, but only when
1255 &$title: the Title object of the file as it would appear for the upload page
1256 &$path: the original file and path name when img_auth was invoked by the the web
1258 &$name: the name only component of the file
1259 &$result: The location to pass back results of the hook routine (only used if
1261 $result[0]=The index of the header message
1262 $result[1]=The index of the body text message
1263 $result[2 through n]=Parameters passed to body text message. Please note the
1264 header message cannot receive/use parameters.
1266 'ImportHandleLogItemXMLTag': When parsing a XML tag in a log item.
1267 $reader: XMLReader object
1268 $logInfo: Array of information
1269 Return false to stop further processing of the tag
1271 'ImportHandlePageXMLTag': When parsing a XML tag in a page.
1272 $reader: XMLReader object
1273 $pageInfo: Array of information
1274 Return false to stop further processing of the tag
1276 'ImportHandleRevisionXMLTag': When parsing a XML tag in a page revision.
1277 $reader: XMLReader object
1278 $pageInfo: Array of page information
1279 $revisionInfo: Array of revision information
1280 Return false to stop further processing of the tag
1282 'ImportHandleToplevelXMLTag': When parsing a top level XML tag.
1283 $reader: XMLReader object
1284 Return false to stop further processing of the tag
1286 'ImportHandleUploadXMLTag': When parsing a XML tag in a file upload.
1287 $reader: XMLReader object
1288 $revisionInfo: Array of information
1289 Return false to stop further processing of the tag
1291 'InfoAction': When building information to display on the action=info page.
1292 $context: IContextSource object
1293 &$pageInfo: Array of information
1295 'InitializeArticleMaybeRedirect': MediaWiki check to see if title is a redirect.
1296 $title: Title object ($wgTitle)
1297 $request: WebRequest
1298 $ignoreRedirect: boolean to skip redirect check
1299 $target: Title/string of redirect target
1300 $article: Article object
1302 'InterwikiLoadPrefix': When resolving if a given prefix is an interwiki or not.
1303 Return true without providing an interwiki to continue interwiki search.
1304 $prefix: interwiki prefix we are looking for.
1305 &$iwData: output array describing the interwiki with keys iw_url, iw_local,
1306 iw_trans and optionally iw_api and iw_wikiid.
1308 'InternalParseBeforeSanitize': during Parser's internalParse method just before
1309 the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/
1310 includeonly/onlyinclude and other processings. Ideal for syntax-extensions after
1311 template/parser function execution which respect nowiki and HTML-comments.
1312 &$parser: Parser object
1313 &$text: string containing partially parsed text
1314 &$stripState: Parser's internal StripState object
1316 'InternalParseBeforeLinks': during Parser's internalParse method before links
1317 but after nowiki/noinclude/includeonly/onlyinclude and other processings.
1318 &$parser: Parser object
1319 &$text: string containing partially parsed text
1320 &$stripState: Parser's internal StripState object
1322 'InvalidateEmailComplete': Called after a user's email has been invalidated
1324 $user: user (object) whose email is being invalidated
1326 'IRCLineURL': When constructing the URL to use in an IRC notification.
1327 Callee may modify $url and $query, URL will be constructed as $url . $query
1328 &$url: URL to index.php
1329 &$query: Query string
1331 'IsFileCacheable': Override the result of Article::isFileCacheable() (if true)
1332 $article: article (object) being checked
1334 'IsTrustedProxy': Override the result of wfIsTrustedProxy()
1336 $result: Change this value to override the result of wfIsTrustedProxy()
1338 'isValidEmailAddr': Override the result of User::isValidEmailAddr(), for
1339 instance to return false if the domain name doesn't match your organization.
1340 $addr: The e-mail address entered by the user
1341 &$result: Set this and return false to override the internal checks
1343 'isValidPassword': Override the result of User::isValidPassword()
1344 $password: The password entered by the user
1345 &$result: Set this and return false to override the internal checks
1346 $user: User the password is being validated for
1348 'Language::getMessagesFileName':
1349 $code: The language code or the language we're looking for a messages file for
1350 &$file: The messages file path, you can override this to change the location.
1352 'LanguageGetNamespaces': Provide custom ordering for namespaces or
1353 remove namespaces. Do not use this hook to add namespaces. Use
1354 CanonicalNamespaces for that.
1355 &$namespaces: Array of namespaces indexed by their numbers
1357 'LanguageGetMagic': DEPRECATED, use $magicWords in a file listed in
1358 $wgExtensionMessagesFiles instead.
1359 Use this to define synonyms of magic words depending of the language
1360 $magicExtensions: associative array of magic words synonyms
1361 $lang: language code (string)
1363 'LanguageGetSpecialPageAliases': DEPRECATED, use $specialPageAliases in a file
1364 listed in $wgExtensionMessagesFiles instead.
1365 Use to define aliases of special pages names depending of the language
1366 $specialPageAliases: associative array of magic words synonyms
1367 $lang: language code (string)
1369 'LanguageGetTranslatedLanguageNames': Provide translated language names.
1370 &$names: array of language code => language name
1371 $code language of the preferred translations
1373 'LinkBegin': Used when generating internal and interwiki links in
1374 Linker::link(), before processing starts. Return false to skip default
1375 processing and return $ret. See documentation for Linker::link() for details on
1376 the expected meanings of parameters.
1377 $skin: the Skin object
1378 $target: the Title that the link is pointing to
1379 &$html: the contents that the <a> tag should have (raw HTML); null means
1381 &$customAttribs: the HTML attributes that the <a> tag should have, in
1382 associative array form, with keys and values unescaped. Should be merged with
1383 default values, with a value of false meaning to suppress the attribute.
1384 &$query: the query string to add to the generated URL (the bit after the "?"),
1385 in associative array form, with keys and values unescaped.
1386 &$options: array of options. Can include 'known', 'broken', 'noclasses'.
1387 &$ret: the value to return if your hook returns false.
1389 'LinkEnd': Used when generating internal and interwiki links in Linker::link(),
1390 just before the function returns a value. If you return true, an <a> element
1391 with HTML attributes $attribs and contents $html will be returned. If you
1392 return false, $ret will be returned.
1393 $skin: the Skin object
1394 $target: the Title object that the link is pointing to
1395 $options: the options. Will always include either 'known' or 'broken', and may
1396 include 'noclasses'.
1397 &$html: the final (raw HTML) contents of the <a> tag, after processing.
1398 &$attribs: the final HTML attributes of the <a> tag, after processing, in
1399 associative array form.
1400 &$ret: the value to return if your hook returns false.
1402 'LinkerMakeExternalImage': At the end of Linker::makeExternalImage() just
1404 &$url: the image url
1405 &$alt: the image's alt text
1406 &$img: the new image HTML (if returning false)
1408 'LinkerMakeExternalLink': At the end of Linker::makeExternalLink() just
1411 &$text: the link text
1412 &$link: the new link HTML (if returning false)
1413 &$attribs: the attributes to be applied.
1414 $linkType: The external link type
1416 'LinksUpdate': At the beginning of LinksUpdate::doUpdate() just before the
1418 &$linksUpdate: the LinksUpdate object
1420 'LinksUpdateAfterInsert': At the end of LinksUpdate::incrTableUpdate() after
1421 each link table insert. For example, pagelinks, imagelinks, externallinks.
1422 $linksUpdate: LinksUpdate object
1423 $table: the table to insert links to
1424 $insertions: an array of links to insert
1426 'LinksUpdateComplete': At the end of LinksUpdate::doUpdate() when updating,
1427 including delete and insert, has completed for all link tables
1428 &$linksUpdate: the LinksUpdate object
1430 'LinksUpdateConstructed': At the end of LinksUpdate() is construction.
1431 &$linksUpdate: the LinksUpdate object
1433 'ListDefinedTags': When trying to find all defined tags.
1434 &$tags: The list of tags.
1436 'LoadExtensionSchemaUpdates': Called during database installation and updates.
1437 &updater: A DatabaseUpdater subclass
1439 'LocalFile::getHistory': Called before file history query performed.
1440 $file: the File object
1442 $fields: select fields
1444 $opts: query options
1445 $join_conds: JOIN conditions
1447 'LocalFilePurgeThumbnails': Called before thumbnails for a local file a purged.
1448 $file: the File object
1449 $archiveName: name of an old file version or false if it's the current one
1451 'LocalisationCacheRecache': Called when loading the localisation data into
1453 $cache: The LocalisationCache object
1454 $code: language code
1455 &$alldata: The localisation data from core and extensions
1457 'LogEventsListShowLogExtract': Called before the string is added to OutputPage.
1458 Returning false will prevent the string from being added to the OutputPage.
1459 &$s: html string to show for the log extract
1460 $types: String or Array Log types to show
1461 $page: String or Title The page title to show log entries for
1462 $user: String The user who made the log entries
1463 $param: Associative Array with the following additional options:
1464 - lim Integer Limit of items to show, default is 50
1465 - conds Array Extra conditions for the query (e.g. "log_action != 'revision'")
1466 - showIfEmpty boolean Set to false if you don't want any output in case the
1467 loglist is empty if set to true (default), "No matching items in log" is
1468 displayed if loglist is empty
1469 - msgKey Array If you want a nice box with a message, set this to the key of
1470 the message. First element is the message key, additional optional elements
1471 are parameters for the key that are processed with
1472 wfMessage()->params()->parseAsBlock()
1473 - offset Set to overwrite offset parameter in $wgRequest set to '' to unset
1475 - wrap String Wrap the message in html (usually something like
1476 "<div ...>$1</div>").
1477 - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS)
1479 'LoginAuthenticateAudit': A login attempt for a valid user account either
1480 succeeded or failed. No return data is accepted; this hook is for auditing only.
1481 $user: the User object being authenticated against
1482 $password: the password being submitted and found wanting
1483 $retval: a LoginForm class constant with authenticateUserData() return
1484 value (SUCCESS, WRONG_PASS, etc.).
1486 'LogLine': Processes a single log entry on Special:Log.
1487 $log_type: string for the type of log entry (e.g. 'move'). Corresponds to
1488 logging.log_type database field.
1489 $log_action: string for the type of log action (e.g. 'delete', 'block',
1490 'create2'). Corresponds to logging.log_action database field.
1491 $title: Title object that corresponds to logging.log_namespace and
1492 logging.log_title database fields.
1493 $paramArray: Array of parameters that corresponds to logging.log_params field.
1494 Note that only $paramArray[0] appears to contain anything.
1495 &$comment: string that corresponds to logging.log_comment database field, and
1496 which is displayed in the UI.
1497 &$revert: string that is displayed in the UI, similar to $comment.
1498 $time: timestamp of the log entry (added in 1.12)
1500 'MaintenanceRefreshLinksInit': before executing the refreshLinks.php maintenance
1502 $refreshLinks: RefreshLinks object
1504 'MagicWordwgVariableIDs': When defining new magic words IDs.
1505 $variableIDs: array of strings
1507 'MakeGlobalVariablesScript': Called right before Skin::makeVariablesScript is
1508 executed. Ideally, this hook should only be used to add variables that depend on
1509 the current page/request; static configuration should be added through
1510 ResourceLoaderGetConfigVars instead.
1511 &$vars: variable (or multiple variables) to be added into the output of
1512 Skin::makeVariablesScript
1513 $out: The OutputPage which called the hook, can be used to get the real title.
1515 'MarkPatrolled': Before an edit is marked patrolled.
1516 $rcid: ID of the revision to be marked patrolled
1517 $user: the user (object) marking the revision as patrolled
1518 $wcOnlySysopsCanPatrol: config setting indicating whether the user needs to be a
1519 sysop in order to mark an edit patrolled.
1521 'MarkPatrolledComplete': After an edit is marked patrolled.
1522 $rcid: ID of the revision marked as patrolled
1523 $user: user (object) who marked the edit patrolled
1524 $wcOnlySysopsCanPatrol: config setting indicating whether the user must be a
1525 sysop to patrol the edit.
1527 'MediaWikiPerformAction': Override MediaWiki::performAction(). Use this to do
1528 something completely different, after the basic globals have been set up, but
1529 before ordinary actions take place.
1531 $article: $wgArticle
1534 $request: $wgRequest
1535 $mediaWiki: The $mediawiki object
1537 'MessagesPreLoad': When loading a message from the database.
1538 $title: title of the message (string)
1539 $message: value (string), change it to the message you want to define
1541 'MessageCacheReplace': When a message page is changed. Useful for updating
1543 $title: name of the page changed.
1544 $text: new contents of the page.
1546 'ModifyExportQuery': Modify the query used by the exporter.
1547 $db: The database object to be queried.
1548 &$tables: Tables in the query.
1549 &$conds: Conditions in the query.
1550 &$opts: Options for the query.
1551 &$join_conds: Join conditions for the query.
1553 'MonoBookTemplateToolboxEnd': DEPRECATED. Called by Monobook skin after toolbox
1554 links have been rendered (useful for adding more). Note: this is only run for
1555 the Monobook skin. To add items to the toolbox you should use the
1556 SkinTemplateToolboxEnd hook instead, which works for all "SkinTemplate"-type
1558 $tools: array of tools
1560 'BaseTemplateToolbox': Called by BaseTemplate when building the $toolbox array
1561 and returning it for the skin to output. You can add items to the toolbox while
1562 still letting the skin make final decisions on skin-specific markup conventions
1564 &$sk: The BaseTemplate base skin template
1565 &$toolbox: An array of toolbox items, see BaseTemplate::getToolbox and
1566 BaseTemplate::makeListItem for details on the format of individual items
1567 inside of this array.
1569 'NamespaceIsMovable': Called when determining if it is possible to pages in a
1571 $index: Integer; the index of the namespace being checked.
1572 $result: Boolean; whether MediaWiki currently thinks that pages in this
1573 namespace are movable. Hooks may change this value to override the return
1574 value of MWNamespace::isMovable().
1576 'NewRevisionFromEditComplete': Called when a revision was inserted due to an
1578 $wikiPage: the WikiPage edited
1579 $rev: the new revision
1580 $baseID: the revision ID this was based off, if any
1581 $user: the editing user
1583 'NormalizeMessageKey': Called before the software gets the text of a message
1584 (stuff in the MediaWiki: namespace), useful for changing WHAT message gets
1586 &$key: the message being looked up. Change this to something else to change
1587 what message gets displayed (string)
1588 &$useDB: whether or not to look up the message in the database (bool)
1589 &$langCode: the language code to get the message for (string) - or -
1590 whether to use the content language (true) or site language (false) (bool)
1591 &$transform: whether or not to expand variables and templates
1592 in the message (bool)
1594 'OldChangesListRecentChangesLine': Customize entire recent changes line, or
1595 return false to omit the line from RecentChanges and Watchlist special pages.
1596 &$changeslist: The OldChangesList instance.
1597 &$s: HTML of the form "<li>...</li>" containing one RC entry.
1598 &$rc: The RecentChange object.
1599 &$classes: array of css classes for the <li> element
1601 'OpenSearchUrls': Called when constructing the OpenSearch description XML. Hooks
1602 can alter or append to the array of URLs for search & suggestion formats.
1603 &$urls: array of associative arrays with Url element attributes
1605 'OtherBlockLogLink': Get links to the block log from extensions which blocks
1606 users and/or IP addresses too.
1607 $otherBlockLink: An array with links to other block logs
1608 $ip: The requested IP address or username
1610 'OutputPageBeforeHTML': A page has been processed by the parser and the
1611 resulting HTML is about to be displayed.
1612 $parserOutput: the parserOutput (object) that corresponds to the page
1613 $text: the text that will be displayed, in HTML (string)
1615 'OutputPageBodyAttributes': Called when OutputPage::headElement is creating the
1616 body tag to allow for extensions to add attributes to the body of the page they
1617 might need. Or to allow building extensions to add body classes that aren't of
1618 high enough demand to be included in core.
1619 $out: The OutputPage which called the hook, can be used to get the real title
1620 $sk: The Skin that called OutputPage::headElement
1621 &$bodyAttrs: An array of attributes for the body tag passed to Html::openElement
1623 'OutputPageCheckLastModified': when checking if the page has been modified
1624 since the last visit.
1625 &$modifiedTimes: array of timestamps.
1626 The following keys are set: page, user, epoch
1628 'OutputPageParserOutput': after adding a parserOutput to $wgOut
1629 $out: OutputPage instance (object)
1630 $parserOutput: parserOutput instance being added in $out
1632 'OutputPageMakeCategoryLinks': Links are about to be generated for the page's
1633 categories. Implementations should return false if they generate the category
1634 links, so the default link generation is skipped.
1635 $out: OutputPage instance (object)
1636 $categories: associative array, keys are category names, values are category
1637 types ("normal" or "hidden")
1638 $links: array, intended to hold the result. Must be an associative array with
1639 category types as keys and arrays of HTML links as values.
1641 'PageContentInsertComplete': After a new article is created.
1642 $wikiPage: WikiPage created
1643 $user: User creating the article
1644 $content: New content as a Content object
1645 $summary: Edit summary/comment
1646 $isMinor: Whether or not the edit was marked as minor
1647 $isWatch: (No longer used)
1648 $section: (No longer used)
1649 $flags: Flags passed to WikiPage::doEditContent()
1650 $revision: New Revision of the article
1652 'PageContentLanguage': Allows changing the language in which the content of a
1653 page is written. Defaults to the wiki content language ($wgContLang).
1654 $title: Title object
1655 &$pageLang: the page content language (either an object or a language code)
1656 $wgLang: the user language
1658 'PageContentSave': Before an article is saved.
1659 $wikiPage: the WikiPage (object) being saved
1660 $user: the user (object) saving the article
1661 $content: the new article content, as a Content object
1662 $summary: the article summary (comment)
1663 $isminor: minor flag
1664 $iswatch: watch flag
1667 'PageContentSaveComplete': After an article has been updated.
1668 $wikiPage: WikiPage modified
1669 $user: User performing the modification
1670 $content: New content, as a Content object
1671 $summary: Edit summary/comment
1672 $isMinor: Whether or not the edit was marked as minor
1673 $isWatch: (No longer used)
1674 $section: (No longer used)
1675 $flags: Flags passed to WikiPage::doEditContent()
1676 $revision: New Revision of the article
1677 $status: Status object about to be returned by doEditContent()
1678 $baseRevId: the rev ID (or false) this edit was based on
1680 'PageHistoryBeforeList': When a history page list is about to be constructed.
1681 $article: the article that the history is loading for
1682 $context: RequestContext object
1684 'PageHistoryLineEnding' : Right before the end <li> is added to a history line.
1685 $row: the revision row for this line
1686 $s: the string representing this parsed line
1687 $classes: array containing the <li> element classes
1689 'PageHistoryPager::getQueryInfo': when a history pager query parameter set is
1692 $queryInfo: the query parameters
1694 'PageRenderingHash': Alter the parser cache option hash key. A parser extension
1695 which depends on user options should install this hook and append its values to
1697 $hash: reference to a hash key string which can be modified
1699 'ParserAfterParse': Called from Parser::parse() just after the call to
1700 Parser::internalParse() returns.
1701 $parser: parser object
1702 $text: text being parsed
1703 $stripState: stripState used (object)
1705 'ParserAfterStrip': Called at end of parsing time.
1706 TODO: No more strip, deprecated ?
1707 $parser: parser object
1708 $text: text being parsed
1709 $stripState: stripState used (object)
1711 'ParserAfterTidy': Called after Parser::tidy() in Parser::parse()
1712 $parser: Parser object being used
1713 $text: text that will be returned
1715 'ParserBeforeInternalParse': Called at the beginning of Parser::internalParse().
1716 $parser: Parser object
1717 $text: text to parse
1718 $stripState: StripState instance being used
1720 'ParserBeforeStrip': Called at start of parsing time.
1721 TODO: No more strip, deprecated ?
1722 $parser: parser object
1723 $text: text being parsed
1724 $stripState: stripState used (object)
1726 'ParserBeforeTidy': Called before tidy and custom tags replacements.
1727 $parser: Parser object being used
1730 'ParserClearState': Called at the end of Parser::clearState().
1731 $parser: Parser object being cleared
1733 'ParserCloned': Called when the parser is cloned.
1734 $parser: Newly-cloned Parser object
1736 'ParserFirstCallInit': Called when the parser initialises for the first time.
1737 &$parser: Parser object being cleared
1739 'ParserGetVariableValueSwitch': Called when the parser need the value of a
1741 $parser: Parser object
1742 $varCache: array to store the value in case of multiples calls of the
1744 $index: index (string) of the magic
1745 $ret: value of the magic word (the hook should set it)
1746 $frame: PPFrame object to use for expanding any template variables
1748 'ParserGetVariableValueTs': Use this to change the value of the time for the
1749 {{LOCAL...}} magic word.
1750 $parser: Parser object
1751 $time: actual time (timestamp)
1753 'ParserGetVariableValueVarCache': use this to change the value of the variable
1754 cache or return false to not use it.
1755 $parser: Parser object
1756 $varCache: variable cache (array)
1758 'ParserLimitReport': Called at the end of Parser:parse() when the parser will
1759 include comments about size of the text parsed.
1760 $parser: Parser object
1761 $limitReport: text that will be included (without comment tags)
1763 'ParserMakeImageParams': Called before the parser make an image link, use this
1764 to modify the parameters of the image.
1765 $title: title object representing the file
1766 $file: file object that will be used to create the image
1767 &$params: 2-D array of parameters
1768 $parser: Parser object that called the hook
1770 'ParserSectionCreate': Called each time the parser creates a document section
1771 from wikitext. Use this to apply per-section modifications to HTML (like
1772 wrapping the section in a DIV). Caveat: DIVs are valid wikitext, and a DIV
1773 can begin in one section and end in another. Make sure your code can handle
1774 that case gracefully. See the EditSectionClearerLink extension for an example.
1775 $parser: the calling Parser instance
1776 $section: the section number, zero-based, but section 0 is usually empty
1777 &$sectionContent: ref to the content of the section. modify this.
1778 $showEditLinks: boolean describing whether this section has an edit link
1780 'ParserTestParser': Called when creating a new instance of Parser in
1781 maintenance/parserTests.inc.
1782 $parser: Parser object created
1784 'ParserTestGlobals': Allows to define globals for parser tests.
1785 &$globals: Array with all the globals which should be set for parser tests.
1786 The arrays keys serve as the globals names, its values are the globals values.
1788 'ParserTestTables': Alter the list of tables to duplicate when parser tests are
1789 run. Use when page save hooks require the presence of custom tables to ensure
1790 that tests continue to run properly.
1791 &$tables: array of table names
1793 'PersonalUrls': Alter the user-specific navigation links (e.g. "my page,
1794 my talk page, my contributions" etc).
1795 &$personal_urls: Array of link specifiers (see SkinTemplate.php)
1796 &$title: Title object representing the current page
1798 'PingLimiter': Allows extensions to override the results of User::pingLimiter().
1799 &$user : User performing the action
1800 $action : Action being performed
1801 &$result : Whether or not the action should be prevented
1802 Change $result and return false to give a definitive answer, otherwise
1803 the built-in rate limiting checks are used, if enabled.
1805 'PlaceNewSection': Override placement of new sections. Return false and put the
1806 merged text into $text to override the default behavior.
1807 $wikipage : WikiPage object
1808 $oldtext : the text of the article before editing
1809 $subject : subject of the new section
1810 &$text : text of the new section
1812 'PreferencesGetLegend': Override the text used for the <legend> of a
1813 preferences section.
1814 $form: the PreferencesForm object. This is a ContextSource as well
1815 $key: the section name
1816 &$legend: the legend text. Defaults to wfMessage( "prefs-$key" )->text() but may be overridden
1818 'PrefixSearchBackend': Override the title prefix search used for OpenSearch and
1819 AJAX search suggestions. Put results into &$results outparam and return false.
1820 $ns : array of int namespace keys to search in
1821 $search : search term (not guaranteed to be conveniently normalized)
1822 $limit : maximum number of results to return
1823 &$results : out param: array of page names (strings)
1825 'PrefsEmailAudit': Called when user changes their email address.
1826 $user: User (object) changing his email address
1827 $oldaddr: old email address (string)
1828 $newaddr: new email address (string)
1830 'PrefsPasswordAudit': Called when user changes his password.
1831 $user: User (object) changing his password
1832 $newPass: new password
1833 $error: error (string) 'badretype', 'wrongpassword', 'error' or 'success'
1835 'ProtectionForm::buildForm': Called after all protection type fieldsets are made
1837 $article: the title being (un)protected
1838 $output: a string of the form HTML so far
1840 'ProtectionForm::save': Called when a protection form is submitted.
1841 $article: the title being (un)protected
1842 $errorMsg: an html message string of an error or an array of message name and
1845 'ProtectionForm::showLogExtract': Called after the protection log extract is
1847 $article: the page the form is shown for
1848 $out: OutputPage object
1850 'RawPageViewBeforeOutput': Right before the text is blown out in action=raw.
1851 &$obj: RawPage object
1852 &$text: The text that's going to be the output
1854 'RecentChange_save': Called at the end of RecentChange::save().
1855 $recentChange: RecentChange object
1857 'RedirectSpecialArticleRedirectParams': Lets you alter the set of parameter
1858 names such as "oldid" that are preserved when using redirecting special pages
1859 such as Special:MyPage and Special:MyTalk.
1860 &$redirectParams: An array of parameters preserved by redirecting special pages.
1862 'RequestContextCreateSkin': Called when RequestContext::getSkin creates a skin
1863 instance. Can be used by an extension override what skin is used in certain
1865 IContextSource $context: The RequestContext the skin is being created for.
1866 &$skin: A variable reference you may set a Skin instance or string key on to
1867 override the skin that will be used for the context.
1869 'ResourceLoaderGetConfigVars': Called at the end of
1870 ResourceLoaderStartUpModule::getConfig(). Use this to export static
1871 configuration variables to JavaScript. Things that depend on the current page
1872 or request state must be added through MakeGlobalVariablesScript instead.
1873 &$vars: array( variable name => value )
1875 'ResourceLoaderGetStartupModules': Run once the startup module is being
1876 generated. This allows you to add modules to the startup module. This hook
1877 should be used sparingly since any module added here will be loaded on all
1878 pages. This hook is useful if you want to make code available to module loader
1881 'ResourceLoaderRegisterModules': Right before modules information is required,
1882 such as when responding to a resource
1883 loader request or generating HTML output.
1884 &$resourceLoader: ResourceLoader object
1886 'ResourceLoaderTestModules': Let you add new JavaScript testing modules. This is
1887 called after the addition of 'qunit' and MediaWiki testing resources.
1888 &testModules: array of JavaScript testing modules. The 'qunit' framework,
1889 included in core, is fed using tests/qunit/QUnitTestResources.php.
1890 &ResourceLoader object
1892 To add a new qunit module named 'myext.tests':
1893 testModules['qunit']['myext.tests'] = array(
1894 'script' => 'extension/myext/tests.js',
1895 'dependencies' => <any module dependency you might have>
1897 For QUnit framework, the mediawiki.tests.qunit.testrunner dependency will be
1898 added to any module.
1900 'RevisionInsertComplete': Called after a revision is inserted into the database.
1901 &$revision: the Revision
1902 $data: the data stored in old_text. The meaning depends on $flags: if external
1903 is set, it's the URL of the revision text in external storage; otherwise,
1904 it's the revision text itself. In either case, if gzip is set, the revision
1906 $flags: a comma-delimited list of strings representing the options used. May
1907 include: utf8 (this will always be set for new revisions); gzip; external.
1909 'SearchUpdate': Prior to search update completion.
1911 $namespace : Page namespace
1913 $text : Current text being indexed
1915 'SearchGetNearMatchBefore': Perform exact-title-matches in "go" searches before
1916 the normal operations.
1917 $allSearchTerms : Array of the search terms in all content languages
1918 &$titleResult : Outparam; the value to return. A Title object or null.
1920 'SearchAfterNoDirectMatch': If there was no match for the exact result. This
1921 runs before lettercase variants are attempted, whereas 'SearchGetNearMatch'
1923 $term : Search term string
1924 &$title : Outparam; set to $title object and return false for a match
1926 'SearchGetNearMatch': An extra chance for exact-title-matches in "go" searches
1927 if nothing was found.
1928 $term : Search term string
1929 &$title : Outparam; set to $title object and return false for a match
1931 'SearchGetNearMatchComplete': A chance to modify exact-title-matches in "go"
1933 $term : Search term string
1934 &$title : Current Title object that is being returned (null if none found).
1936 'SearchEngineReplacePrefixesComplete': Run after SearchEngine::replacePrefixes().
1937 $searchEngine : The SearchEngine object. Users of this hooks will be interested
1938 in the $searchEngine->namespaces array.
1939 $query : Original query.
1940 &$parsed : Resultant query with the prefixes stripped.
1942 'SearchResultInitFromTitle': Set the revision used when displaying a page in
1944 $title : Current Title object being displayed in search results.
1945 &$id: Revision ID (default is false, for latest)
1947 'SearchableNamespaces': An option to modify which namespaces are searchable.
1948 &$arr : Array of namespaces ($nsId => $name) which will be used.
1950 'SeleniumSettings': TODO
1952 'SetupAfterCache': Called in Setup.php, after cache objects are set
1954 'ShowMissingArticle': Called when generating the output for a non-existent page.
1955 $article: The article object corresponding to the page
1957 'ShowRawCssJs': Customise the output of raw CSS and JavaScript in page views.
1958 DEPRECATED, use the ContentHandler facility to handle CSS and JavaScript!
1959 $text: Text being shown
1960 $title: Title of the custom script/stylesheet page
1961 $output: Current OutputPage object
1963 'ShowSearchHitTitle': Customise display of search hit title/link.
1964 &$title: Title to link to
1965 &$text: Text to use for the link
1966 $result: The search result
1967 $terms: The search terms entered
1968 $page: The SpecialSearch object.
1970 'ShowSearchHit': Customize display of search hit.
1971 $searchPage: The SpecialSearch instance.
1972 $result: The SearchResult to show
1973 $terms: Search terms, for highlighting
1974 &$link: HTML of link to the matching page. May be modified.
1975 &$redirect: HTML of redirect info. May be modified.
1976 &$section: HTML of matching section. May be modified.
1977 &$extract: HTML of content extract. May be modified.
1978 &$score: HTML of score. May be modified.
1979 &$size: HTML of page size. May be modified.
1980 &$date: HTML of of page modification date. May be modified.
1981 &$related: HTML of additional info for the matching page. May be modified.
1982 &$html: May be set to the full HTML that should be used to represent the search
1983 hit. Must include the <li> ... </li> tags. Will only be used if the hook
1984 function returned false.
1986 'SiteNoticeBefore': Before the sitenotice/anonnotice is composed. Return true to
1987 allow the normal method of notice selection/rendering to work, or change the
1988 value of $siteNotice and return false to alter it.
1989 &$siteNotice: HTML returned as the sitenotice
1992 'SiteNoticeAfter': After the sitenotice/anonnotice is composed.
1993 &$siteNotice: HTML sitenotice. Alter the contents of $siteNotice to add to/alter
1994 the sitenotice/anonnotice.
1997 'SkinAfterBottomScripts': At the end of Skin::bottomScripts().
1999 &$text: bottomScripts Text. Append to $text to add additional text/scripts after
2000 the stock bottom scripts.
2002 'SkinAfterContent': Allows extensions to add text after the page content and
2003 article metadata. This hook should work in all skins. Set the &$data variable to
2004 the text you're going to add.
2005 &$data: (string) Text to be printed out directly (without parsing)
2008 'SkinBuildSidebar': At the end of Skin::buildSidebar().
2010 &$bar: Sidebar contents
2011 Modify $bar to add or modify sidebar portlets.
2013 'SkinCopyrightFooter': Allow for site and per-namespace customization of
2015 $title: displayed page title
2016 $type: 'normal' or 'history' for old/diff views
2017 &$msg: overridable message; usually 'copyright' or 'history_copyright'. This
2018 message must be in HTML format, not wikitext!
2019 &$link: overridable HTML link to be passed into the message as $1
2020 &$forContent: overridable flag if copyright footer is shown in content language.
2022 'SkinGetPoweredBy': TODO
2023 &$text: additional 'powered by' icons in HTML. Note: Modern skin does not use
2024 the MediaWiki icon but plain text instead.
2027 'SkinSubPageSubtitle': At the beginning of Skin::subPageSubtitle().
2028 &$subpages: Subpage links HTML
2030 $out: OutputPage object
2031 If false is returned $subpages will be used instead of the HTML
2032 subPageSubtitle() generates.
2033 If true is returned, $subpages will be ignored and the rest of
2034 subPageSubtitle() will run.
2036 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink': After creating the "permanent
2038 $sktemplate: SkinTemplate object
2039 $nav_urls: array of tabs
2041 To alter the structured navigation links in SkinTemplates, there are three
2042 hooks called in different spots:
2044 'SkinTemplateNavigation': Called on content pages after the tabs have been
2045 added, but before variants have been added.
2046 'SkinTemplateNavigation::SpecialPage': Called on special pages after the special
2047 tab is added but before variants have been added.
2048 'SkinTemplateNavigation::Universal': Called on both content and special pages
2049 after variants have been added.
2050 &$sktemplate: SkinTemplate object
2051 &$links: Structured navigation links. This is used to alter the navigation for
2052 skins which use buildNavigationUrls such as Vector.
2054 'SkinTemplateOutputPageBeforeExec': Before SkinTemplate::outputPage() starts
2056 &$sktemplate: SkinTemplate object
2057 &$tpl: Template engine object
2059 'SkinTemplatePreventOtherActiveTabs': Use this to prevent showing active tabs.
2060 $sktemplate: SkinTemplate object
2061 $res: set to true to prevent active tabs
2063 'SkinTemplateTabAction': Override SkinTemplate::tabAction().
2064 You can either create your own array, or alter the parameters for
2066 &$sktemplate: The SkinTemplate instance.
2067 $title: Title instance for the page.
2068 $message: Visible label of tab.
2069 $selected: Whether this is a selected tab.
2070 $checkEdit: Whether or not the action=edit query should be added if appropriate.
2071 &$classes: Array of CSS classes to apply.
2072 &$query: Query string to add to link.
2074 &$result: Complete assoc. array if you want to return true.
2076 'SkinTemplateTabs': TODO
2078 'SkinTemplateToolboxEnd': Called by SkinTemplate skins after toolbox links have
2079 been rendered (useful for adding more).
2080 $sk: The QuickTemplate based skin template running the hook.
2081 $dummy: Called when SkinTemplateToolboxEnd is used from a BaseTemplate skin,
2082 extensions that add support for BaseTemplateToolbox should watch for this
2083 dummy parameter with "$dummy=false" in their code and return without echoing
2084 any HTML to avoid creating duplicate toolbox items.
2086 'SoftwareInfo': Called by Special:Version for returning information about the
2088 $software: The array of software in format 'name' => 'version'. See
2089 SpecialVersion::softwareInformation().
2091 'SpecialContributionsBeforeMainOutput': Before the form on Special:Contributions
2092 $id: User identifier
2094 'SpecialListusersDefaultQuery': Called right before the end of
2095 UsersPager::getDefaultQuery().
2096 $pager: The UsersPager instance
2097 $query: The query array to be returned
2099 'SpecialListusersFormatRow': Called right before the end of
2100 UsersPager::formatRow().
2101 $item: HTML to be returned. Will be wrapped in <li></li> after the hook finishes
2102 $row: Database row object
2104 'SpecialListusersHeader': Called before closing the <fieldset> in
2105 UsersPager::getPageHeader().
2106 $pager: The UsersPager instance
2107 $out: The header HTML
2109 'SpecialListusersHeaderForm': Called before adding the submit button in
2110 UsersPager::getPageHeader().
2111 $pager: The UsersPager instance
2112 $out: The header HTML
2114 'SpecialListusersQueryInfo': Called right before the end of.
2115 UsersPager::getQueryInfo()
2116 $pager: The UsersPager instance
2117 $query: The query array to be returned
2119 'SpecialMovepageAfterMove': Called after moving a page.
2120 $movePage: MovePageForm object
2121 $oldTitle: old title (object)
2122 $newTitle: new title (object)
2124 'SpecialNewpagesConditions': Called when building sql query for
2126 &$special: NewPagesPager object (subclass of ReverseChronologicalPager)
2127 $opts: FormOptions object containing special page options
2128 &$conds: array of WHERE conditionals for query
2129 &tables: array of tables to be queried
2130 &$fields: array of columns to select
2131 &$join_conds: join conditions for the tables
2133 'SpecialNewPagesFilters': Called after building form options at NewPages.
2134 $special: the special page object
2135 &$filters: associative array of filter definitions. The keys are the HTML
2136 name/URL parameters. Each key maps to an associative array with a 'msg'
2137 (message key) and a 'default' value.
2139 'SpecialPage_initList': Called when setting up SpecialPage::$mList, use this
2140 hook to remove a core special page.
2141 $list: list (array) of core special pages
2143 'SpecialPageAfterExecute': Called after SpecialPage::execute.
2144 $special: the SpecialPage object
2145 $subPage: the subpage string or null if no subpage was specified
2147 'SpecialPageBeforeExecute': Called before SpecialPage::execute.
2148 $special: the SpecialPage object
2149 $subPage: the subpage string or null if no subpage was specified
2151 'SpecialPasswordResetOnSubmit': When executing a form submission on
2152 Special:PasswordReset.
2153 $users: array of User objects.
2154 $data: array of data submitted by the user
2155 &$error: string, error code (message key) used to describe to error (out
2156 parameter). The hook needs to return false when setting this, otherwise it
2157 will have no effect.
2159 'SpecialRandomGetRandomTitle': Called during the execution of Special:Random,
2160 use this to change some selection criteria or substitute a different title.
2161 &$randstr: The random number from wfRandom()
2162 &$isRedir: Boolean, whether to select a redirect or non-redirect
2163 &$namespaces: An array of namespace indexes to get the title from
2164 &$extra: An array of extra SQL statements
2165 &$title: If the hook returns false, a Title object to use instead of the
2166 result from the normal query
2168 'SpecialRecentChangesFilters': Called after building form options at
2170 $special: the special page object
2171 &$filters: associative array of filter definitions. The keys are the HTML
2172 name/URL parameters. Each key maps to an associative array with a 'msg'
2173 (message key) and a 'default' value.
2175 'SpecialRecentChangesPanel': Called when building form options in
2176 SpecialRecentChanges.
2177 &$extraOpts: array of added items, to which can be added
2178 $opts: FormOptions for this request
2180 'SpecialRecentChangesQuery': Called when building SQL query for
2181 SpecialRecentChanges and SpecialRecentChangesLinked.
2182 &$conds: array of WHERE conditionals for query
2183 &$tables: array of tables to be queried
2184 &$join_conds: join conditions for the tables
2185 $opts: FormOptions for this request
2186 &$query_options: array of options for the database request
2187 &$select: Array of columns to select
2189 'SpecialSearchCreateLink': Called when making the message to create a page or
2190 go to the existing page.
2191 $t: title object searched for
2192 &$params: an array of the default message name and page title (as parameter)
2194 'SpecialSearchGo': Called when user clicked the "Go".
2195 &$title: title object generated from the text entered by the user
2196 &$term: the search term entered by the user
2198 'SpecialSearchNogomatch': Called when user clicked the "Go" button but the
2199 target doesn't exist.
2200 &$title: title object generated from the text entered by the user
2202 'SpecialSearchPowerBox': The equivalent of SpecialSearchProfileForm for
2203 the advanced form, a.k.a. power search box.
2204 &$showSections: an array to add values with more options to
2205 $term: the search term (not a title object)
2206 $opts: an array of hidden options (containing 'redirs' and 'profile')
2208 'SpecialSearchProfiles': Allows modification of search profiles.
2209 &$profiles: profiles, which can be modified.
2211 'SpecialSearchProfileForm': Allows modification of search profile forms.
2212 $search: special page object
2213 &$form: String: form html
2214 $profile: String: current search profile
2215 $term: String: search term
2216 $opts: Array: key => value of hidden options for inclusion in custom forms
2218 'SpecialSearchSetupEngine': Allows passing custom data to search engine.
2219 $search: SpecialSearch special page object
2220 $profile: String: current search profile
2221 $engine: the search engine
2223 'SpecialSearchResultsPrepend': Called immediately before returning HTML
2224 on the search results page. Useful for including an external search
2225 provider. To disable the output of MediaWiki search output, return
2227 $specialSearch: SpecialSearch object ($this)
2229 $term: Search term specified by the user
2231 'SpecialSearchResultsAppend': Called after all search results HTML has
2232 been output. Note that in some cases, this hook will not be called (no
2233 results, too many results, SpecialSearchResultsPrepend returned false,
2235 $specialSearch: SpecialSearch object ($this)
2237 $term: Search term specified by the user
2239 'SpecialSearchResults': Called before search result display when there are
2241 $term: string of search term
2242 &$titleMatches: empty or SearchResultSet object
2243 &$textMatches: empty or SearchResultSet object
2245 'SpecialSearchNoResults': Called before search result display when there are no
2247 $term: string of search term
2249 'SpecialStatsAddExtra': Add extra statistic at the end of Special:Statistics.
2250 &$extraStats: Array to save the new stats
2251 ( $extraStats['<name of statistic>'] => <value>; )
2253 'SpecialUploadComplete': Called after successfully uploading a file from
2255 $form: The SpecialUpload object
2257 'SpecialVersionExtensionTypes': Called when generating the extensions credits,
2258 use this to change the tables headers.
2259 $extTypes: associative array of extensions types
2261 'SpecialVersionVersionUrl': Called when building the URL for Special:Version.
2262 $wgVersion: Current $wgVersion for you to use
2263 &$versionUrl: Raw url to link to (eg: release notes)
2265 'SpecialWatchlistFilters': Called after building form options at Watchlist.
2266 $special: the special page object
2267 &$filters: associative array of filter definitions. The keys are the HTML
2268 name/URL parameters. Each key maps to an associative array with a 'msg'
2269 (message key) and a 'default' value.
2271 'SpecialWatchlistQuery': Called when building sql query for SpecialWatchlist.
2272 &$conds: array of WHERE conditionals for query
2273 &$tables: array of tables to be queried
2274 &$join_conds: join conditions for the tables
2275 &$fields: array of query fields
2276 $values: array of variables with watchlist options
2278 'TestCanonicalRedirect': Called when about to force a redirect to a canonical
2279 URL for a title when we have no other parameters on the URL. Gives a chance for
2280 extensions that alter page view behavior radically to abort that redirect or
2282 $request: WebRequest
2283 $title: Title of the currently found title obj
2284 $output: OutputPage object
2286 'ThumbnailBeforeProduceHTML': Called before an image HTML is about to be
2287 rendered (by ThumbnailImage:toHtml method).
2288 $thumbnail: the ThumbnailImage object
2289 &$attribs: image attribute array
2290 &$linkAttribs: image link attribute array
2292 'TitleArrayFromResult': Called when creating an TitleArray object from a
2294 &$titleArray: set this to an object to override the default object returned
2295 $res: database result used to create the object
2297 'TitleGetRestrictionTypes': Allows extensions to modify the types of protection
2298 that can be applied.
2299 $title: The title in question.
2300 &$types: The types of protection available.
2302 'TitleIsCssOrJsPage': Called when determining if a page is a CSS or JS page.
2303 $title: Title object that is being checked
2304 $result: Boolean; whether MediaWiki currently thinks this is a CSS/JS page.
2305 Hooks may change this value to override the return value of
2306 Title::isCssOrJsPage().
2308 'TitleIsAlwaysKnown': Called when determining if a page exists. Allows
2309 overriding default behavior for determining if a page exists. If $isKnown is
2310 kept as null, regular checks happen. If it's a boolean, this value is returned
2311 by the isKnown method.
2312 $title: Title object that is being checked
2313 &$isKnown: Boolean|null; whether MediaWiki currently thinks this page is known
2315 'TitleIsMovable': Called when determining if it is possible to move a page. Note
2316 that this hook is not called for interwiki pages or pages in immovable
2317 namespaces: for these, isMovable() always returns false.
2318 $title: Title object that is being checked
2319 $result: Boolean; whether MediaWiki currently thinks this page is movable.
2320 Hooks may change this value to override the return value of
2323 'TitleIsWikitextPage': Called when determining if a page is a wikitext or should
2324 be handled by separate handler (via ArticleViewCustom).
2325 $title: Title object that is being checked
2326 $result: Boolean; whether MediaWiki currently thinks this is a wikitext page.
2327 Hooks may change this value to override the return value of
2328 Title::isWikitextPage()
2330 'TitleMoveComplete': After moving an article (title).
2333 $user: user who did the move
2334 $pageid: database ID of the page that's been moved
2335 $redirid: database ID of the created redirect
2337 'TitleReadWhitelist': Called at the end of read permissions checks, just before
2338 adding the default error message if nothing allows the user to read the page. If
2339 a handler wants a title to *not* be whitelisted, it should also return false.
2340 $title: Title object being checked against
2341 $user: Current user object
2342 &$whitelisted: Boolean value of whether this title is whitelisted
2344 'UndeleteForm::showHistory': Called in UndeleteForm::showHistory, after a
2345 PageArchive object has been created but before any further processing is done.
2346 &$archive: PageArchive object
2347 $title: Title object of the page that we're viewing
2349 'UndeleteForm::showRevision': Called in UndeleteForm::showRevision, after a
2350 PageArchive object has been created but before any further processing is done.
2351 &$archive: PageArchive object
2352 $title: Title object of the page that we're viewing
2354 'UndeleteForm::undelete': Called un UndeleteForm::undelete, after checking that
2355 the site is not in read-only mode, that the Title object is not null and after
2356 a PageArchive object has been constructed but before performing any further
2358 &$archive: PageArchive object
2359 $title: Title object of the page that we're about to undelete
2361 'UndeleteShowRevision': Called when showing a revision in Special:Undelete.
2362 $title: title object related to the revision
2363 $rev: revision (object) that will be viewed
2365 'UnknownAction': An unknown "action" has occurred (useful for defining your own
2367 $action: action name
2368 $article: article "acted on"
2370 'UnitTestsList': Called when building a list of files with PHPUnit tests.
2371 &$files: list of files
2373 'UnwatchArticle': Before a watch is removed from an article.
2374 $user: user watching
2375 $page: WikiPage object to be removed
2377 'UnwatchArticleComplete': After a watch is removed from an article.
2378 $user: user that watched
2379 $page: WikiPage object that was watched
2381 'UpdateUserMailerFormattedPageStatus': Before notification email gets sent.
2382 $formattedPageStatus: list of valid page states
2384 'UploadForm:initial': Before the upload form is generated. You might set the
2385 member-variables $uploadFormTextTop and $uploadFormTextAfterSummary to inject
2386 text (HTML) either before or after the editform.
2387 $form: UploadForm object
2389 'UploadForm:BeforeProcessing': At the beginning of processUpload(). Lets you
2390 poke at member variables like $mUploadDescription before the file is saved. Do
2391 not use this hook to break upload processing. This will return the user to a
2392 blank form with no error message; use UploadVerification and UploadVerifyFile
2394 $form: UploadForm object
2396 'UploadCreateFromRequest': When UploadBase::createFromRequest has been called.
2397 $type: (string) the requested upload type
2398 &$className: the class name of the Upload instance to be created
2400 'UploadComplete': when Upload completes an upload.
2401 &$upload: an UploadBase child instance
2403 'UploadFormInitDescriptor': After the descriptor for the upload form as been
2405 $descriptor: (array) the HTMLForm descriptor
2407 'UploadFormSourceDescriptors': after the standard source inputs have been
2408 added to the descriptor
2409 $descriptor: (array) the HTMLForm descriptor
2411 'UploadVerification': Additional chances to reject an uploaded file. Consider
2412 using UploadVerifyFile instead.
2413 string $saveName: destination file name
2414 string $tempName: filesystem path to the temporary file for checks
2415 string &$error: output: message key for message to show if upload canceled by
2416 returning false. May also be an array, where the first element is the message
2417 key and the remaining elements are used as parameters to the message.
2419 'UploadVerifyFile': extra file verification, based on mime type, etc. Preferred
2420 in most cases over UploadVerification.
2421 object $upload: an instance of UploadBase, with all info about the upload
2422 string $mime: The uploaded file's mime type, as detected by MediaWiki. Handlers
2423 will typically only apply for specific mime types.
2424 object &$error: output: true if the file is valid. Otherwise, an indexed array
2425 representing the problem with the file, where the first element is the message
2426 key and the remaining elements are used as parameters to the message.
2428 'UploadComplete': Upon completion of a file upload.
2429 $uploadBase: UploadBase (or subclass) object. File can be accessed by
2430 $uploadBase->getLocalFile().
2432 'User::mailPasswordInternal': before creation and mailing of a user's new
2434 $user: the user who sent the message out
2435 $ip: IP of the user who sent the message out
2436 $u: the account whose new password will be set
2438 'UserAddGroup': Called when adding a group; return false to override
2439 stock group addition.
2440 $user: the user object that is to have a group added
2441 &$group: the group to add, can be modified
2443 'UserArrayFromResult': Called when creating an UserArray object from a database
2445 &$userArray: set this to an object to override the default object returned
2446 $res: database result used to create the object
2448 'userCan': To interrupt/advise the "user can do X to Y article" check. If you
2449 want to display an error message, try getUserPermissionsErrors.
2450 $title: Title object being checked against
2451 $user : Current user object
2452 $action: Action being checked
2453 $result: Pointer to result returned if hook returns false. If null is returned,
2454 userCan checks are continued by internal code.
2456 'UserCanSendEmail': To override User::canSendEmail() permission check.
2457 $user: User (object) whose permission is being checked
2458 &$canSend: bool set on input, can override on output
2460 'UserClearNewTalkNotification': Called when clearing the "You have new
2461 messages!" message, return false to not delete it.
2462 $user: User (object) that will clear the message
2464 'UserComparePasswords': Called when checking passwords, return false to
2465 override the default password checks.
2466 &$hash: String of the password hash (from the database)
2467 &$password: String of the plaintext password the user entered
2468 &$userId: Integer of the user's ID or Boolean false if the user ID was not
2470 &$result: If the hook returns false, this Boolean value will be checked to
2471 determine if the password was valid
2473 'UserCreateForm': change to manipulate the login form
2474 $template: SimpleTemplate instance for the form
2476 'UserCryptPassword': Called when hashing a password, return false to implement
2477 your own hashing method.
2478 &$password: String of the plaintext password to encrypt
2479 &$salt: String of the password salt or Boolean false if no salt is provided
2480 &$wgPasswordSalt: Boolean of whether the salt is used in the default hashing
2482 &$hash: If the hook returns false, this String will be used as the hash
2484 'UserEffectiveGroups': Called in User::getEffectiveGroups().
2485 $user: User to get groups for
2486 &$groups: Current effective groups
2488 'UserGetAllRights': After calculating a list of all available rights.
2489 &$rights: Array of rights, which may be added to.
2491 'UserGetDefaultOptions': After fetching the core default, this hook is run right
2492 before returning the options to the caller. Warning: This hook is called for
2493 every call to User::getDefaultOptions(), which means it's potentially called
2494 dozens or hundreds of times. You may want to cache the results of non-trivial
2495 operations in your hook function for this reason.
2496 &$defaultOptions: Array of preference keys and their default values.
2498 'UserGetEmail': Called when getting an user email address.
2500 &$email: email, change this to override local email
2502 'UserGetEmailAuthenticationTimestamp': Called when getting the timestamp of
2503 email authentication.
2505 &$timestamp: timestamp, change this to override local email authentication
2508 'UserGetImplicitGroups': Called in User::getImplicitGroups().
2509 &$groups: List of implicit (automatically-assigned) groups
2511 'UserGetLanguageObject': Called when getting user's interface language object.
2513 &$code: Language code that will be used to create the object
2514 $context: RequestContext object
2516 'UserGetReservedNames': Allows to modify $wgReservedUsernames at run time.
2517 &$reservedUsernames: $wgReservedUsernames
2519 'UserGetRights': Called in User::getRights().
2520 $user: User to get rights for
2521 &$rights: Current rights
2523 'UserIsBlockedFrom': Check if a user is blocked from a specific page (for
2524 specific block exemptions).
2525 $user: User in question
2526 $title: Title of the page in question
2527 &$blocked: Out-param, whether or not the user is blocked from that page.
2528 &$allowUsertalk: If the user is blocked, whether or not the block allows users
2529 to edit their own user talk pages.
2531 'UserIsBlockedGlobally': Check if user is blocked on all wikis.
2533 $ip: User's IP address
2534 &$blocked: Whether the user is blocked, to be modified by the hook
2536 'UserLoadAfterLoadFromSession': Called to authenticate users on external or
2537 environmental means; occurs after session is loaded.
2538 $user: user object being loaded
2540 'UserLoadDefaults': Called when loading a default user.
2544 'UserLoadFromDatabase': Called when loading a user from the database.
2546 &$s: database query object
2548 'UserLoadFromSession': Called to authenticate users on external/environmental
2549 means; occurs before session is loaded.
2550 $user: user object being loaded
2551 &$result: set this to a boolean value to abort the normal authentication
2554 'UserLoadOptions': When user options/preferences are being loaded from the
2557 &$options: Options, can be modified.
2559 'UserLoginComplete': After a user has logged in.
2560 $user: the user object that was created on login
2561 $inject_html: Any HTML to inject after the "logged in" message.
2563 'UserLoginForm': change to manipulate the login form
2564 $template: SimpleTemplate instance for the form
2566 'UserLogout': Before a user logs out.
2567 $user: the user object that is about to be logged out
2569 'UserLogoutComplete': After a user has logged out.
2570 $user: the user object _after_ logout (won't have name, ID, etc.)
2571 $inject_html: Any HTML to inject after the "logged out" message.
2572 $oldName: name of the user before logout (string)
2574 'UserRemoveGroup': Called when removing a group; return false to override stock
2576 $user: the user object that is to have a group removed
2577 &$group: the group to be removed, can be modified
2579 'UserRights': After a user's group memberships are changed.
2580 $user : User object that was changed
2581 $add : Array of strings corresponding to groups added
2582 $remove: Array of strings corresponding to groups removed
2584 'UserRetrieveNewTalks': Called when retrieving "You have new messages!"
2586 $user: user retrieving new talks messages
2587 $talks: array of new talks page(s)
2589 'UserSaveSettings': Called when saving user settings.
2592 'UserSaveOptions': Called just before saving user preferences/options.
2594 &$options: Options, modifiable
2596 'UserSetCookies': Called when setting user cookies.
2598 &$session: session array, will be added to $_SESSION
2599 &$cookies: cookies array mapping cookie name to its value
2601 'UserSetEmail': Called when changing user email address.
2603 &$email: new email, change this to override new email address
2605 'UserSetEmailAuthenticationTimestamp': Called when setting the timestamp of
2606 email authentication.
2608 &$timestamp: new timestamp, change this to override local email
2609 authentication timestamp
2611 'UserToolLinksEdit': Called when generating a list of user tool links, e.g.
2612 "Foobar (Talk | Contribs | Block)".
2613 $userId: User id of the current user
2614 $userText: User name of the current user
2615 &$items: Array of user tool links as HTML fragments
2617 'WantedPages::getQueryInfo': Called in WantedPagesPage::getQueryInfo(), can be
2618 used to alter the SQL query which gets the list of wanted pages.
2619 &$wantedPages: WantedPagesPage object
2620 &$query: query array, see QueryPage::getQueryInfo() for format documentation
2622 'WatchArticle': Before a watch is added to an article.
2623 $user: user that will watch
2624 $page: WikiPage object to be watched
2626 'WatchArticleComplete': After a watch is added to an article.
2627 $user: user that watched
2628 $page: WikiPage object watched
2630 'WatchlistEditorBuildRemoveLine': when building remove lines in
2631 Special:Watchlist/edit.
2632 &$tools: array of extra links
2633 $title: Title object
2634 $redirect: whether the page is a redirect
2637 'WebRequestPathInfoRouter': While building the PathRouter to parse the
2639 $router: The PathRouter instance
2641 'WikiExporter::dumpStableQuery': Get the SELECT query for "stable" revisions
2642 dumps. One, and only one hook should set this, and return false.
2643 &$tables: Database tables to use in the SELECT query
2644 &$opts: Options to use for the query
2645 &$join: Join conditions
2647 'WikiPageDeletionUpdates': manipulate the list of DataUpdates to be applied when
2648 a page is deleted. Called in WikiPage::getDeletionUpdates(). Note that updates
2649 specific to a content model should be provided by the respective Content's
2650 getDeletionUpdates() method.
2652 $content: the Content to generate updates for
2653 &$updates: the array of DataUpdate objects. Hook function may want to add to it.
2655 'wfShellWikiCmd': Called when generating a shell-escaped command line string to
2656 run a MediaWiki cli script.
2657 &$script: MediaWiki cli script path
2658 &$parameters: Array of arguments and options to the script
2659 &$options: Associative array of options, may contain the 'php' and 'wrapper'
2662 'wgQueryPages': Called when initialising $wgQueryPages, use this to add new
2663 query pages to be updated with maintenance/updateSpecialPages.php.
2664 $query: $wgQueryPages itself
2666 'XmlDumpWriterOpenPage': Called at the end of XmlDumpWriter::openPage, to allow
2667 extra metadata to be added.
2668 $obj: The XmlDumpWriter object.
2669 &$out: The output string.
2670 $row: The database row for the page.
2671 $title: The title of the page.
2673 'XmlDumpWriterWriteRevision': Called at the end of a revision in an XML dump, to
2675 $obj: The XmlDumpWriter object.
2676 &$out: The text being output.
2677 $row: The database row for the revision.
2678 $text: The revision text.
2680 'XMPGetInfo': Called when obtaining the list of XMP tags to extract. Can be used
2681 to add additional tags to extract.
2682 &$items: Array containing information on which items to extract. See XMPInfo for
2683 details on the format.
2685 'XMPGetResults': Called just before returning the results array of parsing xmp
2686 data. Can be used to post-process the results.
2687 &$data: Array of metadata sections (such as $data['xmp-general']) each section
2688 is an array of metadata tags returned (each tag is either a value, or an array
2691 More hooks might be available but undocumented, you can execute
2692 'php maintenance/findHooks.php' to find hidden ones.