Added ArticleViewFooter hook to allow extensions adding additional items to the foote...
[lhc/web/wiklou.git] / docs / hooks.txt
1 hooks.txt
2
3 This document describes how event hooks work in MediaWiki; how to add hooks for
4 an event; and how to run hooks for an event.
5
6 ==Glossary==
7
8 event
9 Something that happens with the wiki. For example: a user logs in. A wiki
10 page is saved. A wiki page is deleted. Often there are two events
11 associated with a single action: one before the code is run to make the
12 event happen, and one after. Each event has a name, preferably in
13 CamelCase. For example, 'UserLogin', 'ArticleSave', 'ArticleSaveComplete',
14 'ArticleDelete'.
15
16 hook
17 A clump of code and data that should be run when an event happens. This can
18 be either a function and a chunk of data, or an object and a method.
19
20 hook function
21 The function part of a hook.
22
23 ==Rationale==
24
25 Hooks allow us to decouple optionally-run code from code that is run for
26 everyone. It allows MediaWiki hackers, third-party developers and local
27 administrators to define code that will be run at certain points in the mainline
28 code, and to modify the data run by that mainline code. Hooks can keep mainline
29 code simple, and make it easier to write extensions. Hooks are a principled
30 alternative to local patches.
31
32 Consider, for example, two options in MediaWiki. One reverses the order of a
33 title before displaying the article; the other converts the title to all
34 uppercase letters. Currently, in MediaWiki code, we would handle this as follows
35 (note: not real code, here):
36
37 function showAnArticle($article) {
38 global $wgReverseTitle, $wgCapitalizeTitle;
39
40 if ($wgReverseTitle) {
41 wfReverseTitle($article);
42 }
43
44 if ($wgCapitalizeTitle) {
45 wfCapitalizeTitle($article);
46 }
47
48 # code to actually show the article goes here
49 }
50
51 An extension writer, or a local admin, will often add custom code to the
52 function -- with or without a global variable. For example, someone wanting
53 email notification when an article is shown may add:
54
55 function showAnArticle($article) {
56 global $wgReverseTitle, $wgCapitalizeTitle, $wgNotifyArticle;
57
58 if ($wgReverseTitle) {
59 wfReverseTitle($article);
60 }
61
62 if ($wgCapitalizeTitle) {
63 wfCapitalizeTitle($article);
64 }
65
66 # code to actually show the article goes here
67
68 if ($wgNotifyArticle) {
69 wfNotifyArticleShow($article));
70 }
71 }
72
73 Using a hook-running strategy, we can avoid having all this option-specific
74 stuff in our mainline code. Using hooks, the function becomes:
75
76 function showAnArticle($article) {
77
78 if (wfRunHooks('ArticleShow', array(&$article))) {
79
80 # code to actually show the article goes here
81
82 wfRunHooks('ArticleShowComplete', array(&$article));
83 }
84 }
85
86 We've cleaned up the code here by removing clumps of weird, infrequently used
87 code and moving them off somewhere else. It's much easier for someone working
88 with this code to see what's _really_ going on, and make changes or fix bugs.
89
90 In addition, we can take all the code that deals with the little-used
91 title-reversing options (say) and put it in one place. Instead of having little
92 title-reversing if-blocks spread all over the codebase in showAnArticle,
93 deleteAnArticle, exportArticle, etc., we can concentrate it all in an extension
94 file:
95
96 function reverseArticleTitle($article) {
97 # ...
98 }
99
100 function reverseForExport($article) {
101 # ...
102 }
103
104 The setup function for the extension just has to add its hook functions to the
105 appropriate events:
106
107 setupTitleReversingExtension() {
108 global $wgHooks;
109
110 $wgHooks['ArticleShow'][] = 'reverseArticleTitle';
111 $wgHooks['ArticleDelete'][] = 'reverseArticleTitle';
112 $wgHooks['ArticleExport'][] = 'reverseForExport';
113 }
114
115 Having all this code related to the title-reversion option in one place means
116 that it's easier to read and understand; you don't have to do a grep-find to see
117 where the $wgReverseTitle variable is used, say.
118
119 If the code is well enough isolated, it can even be excluded when not used --
120 making for some slight savings in memory and load-up performance at runtime.
121 Admins who want to have all the reversed titles can add:
122
123 require_once('extensions/ReverseTitle.php');
124
125 ...to their LocalSettings.php file; those of us who don't want or need it can
126 just leave it out.
127
128 The extensions don't even have to be shipped with MediaWiki; they could be
129 provided by a third-party developer or written by the admin him/herself.
130
131 ==Writing hooks==
132
133 A hook is a chunk of code run at some particular event. It consists of:
134
135 * a function with some optional accompanying data, or
136 * an object with a method and some optional accompanying data.
137
138 Hooks are registered by adding them to the global $wgHooks array for a given
139 event. All the following are valid ways to define hooks:
140
141 $wgHooks['EventName'][] = 'someFunction'; # function, no data
142 $wgHooks['EventName'][] = array('someFunction', $someData);
143 $wgHooks['EventName'][] = array('someFunction'); # weird, but OK
144
145 $wgHooks['EventName'][] = $object; # object only
146 $wgHooks['EventName'][] = array($object, 'someMethod');
147 $wgHooks['EventName'][] = array($object, 'someMethod', $someData);
148 $wgHooks['EventName'][] = array($object); # weird but OK
149
150 When an event occurs, the function (or object method) will be called with the
151 optional data provided as well as event-specific parameters. The above examples
152 would result in the following code being executed when 'EventName' happened:
153
154 # function, no data
155 someFunction($param1, $param2)
156 # function with data
157 someFunction($someData, $param1, $param2)
158
159 # object only
160 $object->onEventName($param1, $param2)
161 # object with method
162 $object->someMethod($param1, $param2)
163 # object with method and data
164 $object->someMethod($someData, $param1, $param2)
165
166 Note that when an object is the hook, and there's no specified method, the
167 default method called is 'onEventName'. For different events this would be
168 different: 'onArticleSave', 'onUserLogin', etc.
169
170 The extra data is useful if we want to use the same function or object for
171 different purposes. For example:
172
173 $wgHooks['ArticleSaveComplete'][] = array('ircNotify', 'TimStarling');
174 $wgHooks['ArticleSaveComplete'][] = array('ircNotify', 'brion');
175
176 This code would result in ircNotify being run twice when an article is saved:
177 once for 'TimStarling', and once for 'brion'.
178
179 Hooks can return three possible values:
180
181 * 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
185 function should skip
186
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:
190
191 $wgHooks['UserLogin'][] = array('ldapLogin', $ldapServer);
192
193 function ldapLogin($username, $password) {
194 # log user into LDAP
195 return false;
196 }
197
198 Returning false makes less sense for events where the action is complete, and
199 will normally be ignored.
200
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.
204
205 ==Using hooks==
206
207 A calling function or method uses the wfRunHooks() function to run the hooks
208 related to a particular event, like so:
209
210 class Article {
211 # ...
212 function protect() {
213 global $wgUser;
214 if (wfRunHooks('ArticleProtect', array(&$this, &$wgUser))) {
215 # protect the article
216 wfRunHooks('ArticleProtectComplete', array(&$this, &$wgUser));
217 }
218 }
219 }
220
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.
225
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
230 MediaWiki 1.4rc1.
231
232 ==Events and parameters==
233
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.
236
237 'AbortAutoblock': Return false to cancel an autoblock.
238 $autoblockip: The IP going to be autoblocked.
239 $block: The block from which the autoblock is coming.
240
241 'AbortDiffCache': Can be used to cancel the caching of a diff
242 &$diffEngine: DifferenceEngine object
243
244 'AbortLogin': Return false to cancel account login.
245 $user: the User object being authenticated against
246 $password: the password being submitted, not yet checked for validity
247 &$retval: a LoginForm class constant to return from authenticateUserData();
248 default is LoginForm::ABORTED. Note that the client may be using
249 a machine API rather than the HTML user interface.
250
251 'AbortMove': allows to abort moving an article (title)
252 $old: old title
253 $nt: new title
254 $user: user who is doing the move
255 $err: error message
256 $reason: the reason for the move (added in 1.13)
257
258 'AbortNewAccount': Return false to cancel account creation.
259 $user: the User object about to be created (read-only, incomplete)
260 $message: out parameter: error message to display on abort
261
262 'AddNewAccount': after a user account is created
263 $user: the User object that was created. (Parameter added in 1.7)
264 $byEmail: true when account was created "by email" (added in 1.12)
265
266 'AfterImportPage': When a page import is completed
267 $title: Title under which the revisions were imported
268 $origTitle: Title provided by the XML file
269 $revCount: Number of revisions in the XML file
270 $sRevCount: Number of sucessfully imported revisions
271 $pageInfo: associative array of page information
272
273 'AfterUserMessage': After a user message has been left, this hook is
274 called to take care of any cleanup.
275 $user: The user who we left the message for.
276 $article: The article the message was left on.
277 $subject: The subject of the message
278 $text: The text of the message.
279 $signature: The signature we used.
280 $summary: The edit summary.
281 $editor: The editor that performed the edit.
282
283 'AjaxAddScript': Called in output page just before the initialisation
284 of the javascript ajax engine. The hook is only called when ajax
285 is enabled ( $wgUseAjax = true; ).
286
287 'AlternateEdit': before checking if an user can edit a page and
288 before showing the edit form ( EditPage::edit() ). This is triggered
289 on &action=edit.
290 $EditPage: the EditPage object
291
292 'APIAfterExecute': after calling the execute() method of an API module.
293 Use this to extend core API modules.
294 &$module: Module object
295
296 'APIEditBeforeSave': before saving a page with api.php?action=edit,
297 after processing request parameters. Return false to let the request
298 fail, returning an error message or an <edit result="Failure"> tag
299 if $resultArr was filled.
300 $EditPage : the EditPage object
301 $text : the new text of the article (has yet to be saved)
302 &$resultArr : data in this array will be added to the API result
303
304 'APIGetAllowedParams': use this hook to modify a module's parameters.
305 &$module: Module object
306 &$params: Array of parameters
307
308 'APIGetParamDescription': use this hook to modify a module's parameter
309 descriptions.
310 &$module: Module object
311 &$desc: Array of parameter descriptions
312
313 'APIQueryAfterExecute': after calling the execute() method of an
314 action=query submodule. Use this to extend core API modules.
315 &$module: Module object
316
317 'APIQueryGeneratorAfterExecute': after calling the executeGenerator()
318 method of an action=query submodule. Use this to extend core API modules.
319 &$module: Module object
320 &$resultPageSet: ApiPageSet object
321
322 'APIQueryInfoTokens': use this hook to add custom tokens to prop=info.
323 Every token has an action, which will be used in the intoken parameter
324 and in the output (actiontoken="..."), and a callback function which
325 should return the token, or false if the user isn't allowed to obtain
326 it. The prototype of the callback function is func($pageid, $title)
327 where $pageid is the page ID of the page the token is requested for
328 and $title is the associated Title object. In the hook, just add
329 your callback to the $tokenFunctions array and return true (returning
330 false makes no sense)
331 $tokenFunctions: array(action => callback)
332
333 'APIQueryRevisionsTokens': use this hook to add custom tokens to prop=revisions.
334 Every token has an action, which will be used in the rvtoken parameter
335 and in the output (actiontoken="..."), and a callback function which
336 should return the token, or false if the user isn't allowed to obtain
337 it. The prototype of the callback function is func($pageid, $title, $rev)
338 where $pageid is the page ID of the page associated to the revision the
339 token is requested for, $title the associated Title object and $rev the
340 associated Revision object. In the hook, just add your callback to the
341 $tokenFunctions array and return true (returning false makes no sense)
342 $tokenFunctions: array(action => callback)
343
344 'APIQueryRecentChangesTokens': use this hook to add custom tokens to
345 list=recentchanges.
346 Every token has an action, which will be used in the rctoken parameter
347 and in the output (actiontoken="..."), and a callback function which
348 should return the token, or false if the user isn't allowed to obtain
349 it. The prototype of the callback function is func($pageid, $title, $rc)
350 where $pageid is the page ID of the page associated to the revision the
351 token is requested for, $title the associated Title object and $rc the
352 associated RecentChange object. In the hook, just add your callback to the
353 $tokenFunctions array and return true (returning false makes no sense)
354 $tokenFunctions: array(action => callback)
355
356 'APIQueryUsersTokens': use this hook to add custom token to list=users.
357 Every token has an action, which will be used in the ustoken parameter
358 and in the output (actiontoken="..."), and a callback function which
359 should return the token, or false if the user isn't allowed to obtain
360 it. The prototype of the callback function is func($user) where $user
361 is the User object. In the hook, just add your callback to the
362 $tokenFunctions array and return true (returning false makes no sense)
363 $tokenFunctions: array(action => callback)
364
365 'ApiRsdServiceApis': Add or remove APIs from the RSD services list.
366 Each service should have its own entry in the $apis array and have a
367 unique name, passed as key for the array that represents the service data.
368 In this data array, the key-value-pair identified by the apiLink key is
369 required.
370 &$apis: array of services
371
372 'ArticleAfterFetchContent': after fetching content of an article from
373 the database
374 $article: the article (object) being loaded from the database
375 $content: the content (string) of the article
376
377 'ArticleConfirmDelete': before writing the confirmation form for article
378 deletion
379 $article: the article (object) being deleted
380 $output: the OutputPage object ($wgOut)
381 &$reason: the reason (string) the article is being deleted
382
383 'ArticleContentOnDiff': before showing the article content below a diff.
384 Use this to change the content in this area or how it is loaded.
385 $diffEngine: the DifferenceEngine
386 $output: the OutputPage object ($wgOut)
387
388 'ArticleDelete': before an article is deleted
389 $article: the article (object) being deleted
390 $user: the user (object) deleting the article
391 $reason: the reason (string) the article is being deleted
392 $error: if the deletion was prohibited, the (raw HTML) error message to display
393 (added in 1.13)
394
395 'ArticleDeleteComplete': after an article is deleted
396 $article: the article that was deleted
397 $user: the user that deleted the article
398 $reason: the reason the article was deleted
399 $id: id of the article that was deleted
400
401 'ArticleEditUpdateNewTalk': before updating user_newtalk when a user talk page
402 was changed
403 $article: article (object) of the user talk page
404
405 'ArticleEditUpdates': when edit updates (mainly link tracking) are made when an
406 article has been changed
407 $article: the article (object)
408 $editInfo: data holder that includes the parser output ($editInfo->output) for
409 that page after the change
410 $changed: bool for if the page was changed
411
412 'ArticleEditUpdatesDeleteFromRecentchanges': before deleting old entries from
413 recentchanges table, return false to not delete old entries
414 $article: article (object) being modified
415
416 'ArticleFromTitle': when creating an article object from a title object using
417 Wiki::articleFromTitle()
418 $title: title (object) used to create the article object
419 $article: article (object) that will be returned
420
421 'ArticleInsertComplete': After a new article is created
422 $article: Article created
423 $user: User creating the article
424 $text: New content
425 $summary: Edit summary/comment
426 $isMinor: Whether or not the edit was marked as minor
427 $isWatch: (No longer used)
428 $section: (No longer used)
429 $flags: Flags passed to Article::doEdit()
430 $revision: New Revision of the article
431
432 'ArticleMergeComplete': after merging to article using Special:Mergehistory
433 $targetTitle: target title (object)
434 $destTitle: destination title (object)
435
436 'ArticlePageDataAfter': after loading data of an article from the database
437 $article: article (object) whose data were loaded
438 $row: row (object) returned from the database server
439
440 'ArticlePageDataBefore': before loading data of an article from the database
441 $article: article (object) that data will be loaded
442 $fields: fileds (array) to load from the database
443
444 'ArticleProtect': before an article is protected
445 $article: the article being protected
446 $user: the user doing the protection
447 $protect: boolean whether this is a protect or an unprotect
448 $reason: Reason for protect
449 $moveonly: boolean whether this is for move only or not
450
451 'ArticleProtectComplete': after an article is protected
452 $article: the article that was protected
453 $user: the user who did the protection
454 $protect: boolean whether it was a protect or an unprotect
455 $reason: Reason for protect
456 $moveonly: boolean whether it was for move only or not
457
458 'ArticlePurge': before executing "&action=purge"
459 $article: article (object) to purge
460
461 'ArticleRevisionVisibilitySet': called when changing visibility of one or more
462 revision of an article
463 &$title: title object of the article
464
465 'ArticleRevisionUndeleted': after an article revision is restored
466 $title: the article title
467 $revision: the revision
468 $oldPageID: the page ID of the revision when archived (may be null)
469
470 'ArticleRollbackComplete': after an article rollback is completed
471 $article: the article that was edited
472 $user: the user who did the rollback
473 $revision: the revision the page was reverted back to
474 $current: the reverted revision
475
476 'ArticleSave': before an article is saved
477 $article: the article (object) being saved
478 $user: the user (object) saving the article
479 $text: the new article text
480 $summary: the article summary (comment)
481 $isminor: minor flag
482 $iswatch: watch flag
483 $section: section #
484
485 'ArticleSaveComplete': After an article has been updated
486 $article: Article modified
487 $user: User performing the modification
488 $text: New content
489 $summary: Edit summary/comment
490 $isMinor: Whether or not the edit was marked as minor
491 $isWatch: (No longer used)
492 $section: (No longer used)
493 $flags: Flags passed to Article::doEdit()
494 $revision: New Revision of the article
495 $baseRevId: the rev ID (or false) this edit was based on
496
497 'ArticleUndelete': When one or more revisions of an article are restored
498 $title: Title corresponding to the article restored
499 $create: Whether or not the restoration caused the page to be created
500 (i.e. it didn't exist before)
501 $comment: The comment associated with the undeletion.
502
503 'ArticleUpdateBeforeRedirect': After a page is updated (usually on save),
504 before the user is redirected back to the page
505 &$article: the article
506 &$sectionanchor: The section anchor link (e.g. "#overview" )
507 &$extraq: Extra query parameters which can be added via hooked functions
508
509 'ArticleViewFooter': After showing the footer section of an ordinary page view
510 $article: Article object
511
512 'ArticleViewHeader': Before the parser cache is about to be tried for article
513 viewing.
514 &$article: the article
515 &$pcache: whether to try the parser cache or not
516 &$outputDone: whether the output for this page finished or not
517
518 'ArticleViewRedirect': before setting "Redirected from ..." subtitle when
519 follwed an redirect
520 $article: target article (object)
521
522 'AuthPluginAutoCreate': Called when creating a local account for an user logged
523 in from an external authentication method
524 $user: User object created locally
525
526 'AuthPluginSetup': update or replace authentication plugin object ($wgAuth)
527 Gives a chance for an extension to set it programattically to a variable class.
528 &$auth: the $wgAuth object, probably a stub
529
530 'AutopromoteCondition': check autopromote condition for user.
531 $type: condition type
532 $args: arguments
533 $user: user
534 $result: result of checking autopromote condition
535
536 'BadImage': When checking against the bad image list
537 $name: Image name being checked
538 &$bad: Whether or not the image is "bad"
539
540 Change $bad and return false to override. If an image is "bad", it is not
541 rendered inline in wiki pages or galleries in category pages.
542
543 'BeforeGalleryFindFile': before an image is fetched for a gallery
544 &$gallery,: the gallery object
545 &$nt: the image title
546 &$time: image timestamp
547
548 'BeforeInitialize': before anything is initialized in performRequestForTitle()
549 &$title: Title being used for request
550 &$article: The associated Article object
551 &$output: OutputPage object
552 &$user: User
553 $request: WebRequest object
554 $mediaWiki: Mediawiki object
555
556 'BeforePageDisplay': Prior to outputting a page
557 &$out: OutputPage object
558 &$skin: Skin object
559
560 'BeforeParserFetchTemplateAndtitle': before a template is fetched by Parser
561 &$parser: Parser object
562 &$title: title of the template
563 &$skip: skip this template and link it?
564 &$id: the id of the revision being parsed
565
566 'BeforeParserMakeImageLinkObj': before an image is rendered by Parser
567 &$parser: Parser object
568 &$nt: the image title
569 &$skip: skip this image and link it?
570 &$time: the image timestamp
571
572 'BeforeParserrenderImageGallery': before an image gallery is rendered by Parser
573 &$parser: Parser object
574 &$ig: ImageGallery object
575
576 'BlockIp': before an IP address or user is blocked
577 $block: the Block object about to be saved
578 $user: the user _doing_ the block (not the one being blocked)
579
580 'BlockIpComplete': after an IP address or user is blocked
581 $block: the Block object that was saved
582 $user: the user who did the block (not the one being blocked)
583
584 'BookInformation': Before information output on Special:Booksources
585 $isbn: ISBN to show information for
586 $output: OutputPage object in use
587
588 'CanonicalNamespaces': For extensions adding their own namespaces or altering the defaults
589 &$namespaces: Array of namespace numbers with corresponding canonical names
590
591 'CategoryPageView': before viewing a categorypage in CategoryPage::view
592 $catpage: CategoryPage instance
593
594 'ChangesListInsertArticleLink': Override or augment link to article in RC list.
595 &$changesList: ChangesList instance.
596 &$articlelink: HTML of link to article (already filled-in).
597 &$s: HTML of row that is being constructed.
598 &$rc: RecentChange instance.
599 $unpatrolled: Whether or not we are showing unpatrolled changes.
600 $watched: Whether or not the change is watched by the user.
601
602 'ConfirmEmailComplete': Called after a user's email has been confirmed successfully
603 $user: user (object) whose email is being confirmed
604
605 'ContribsPager::getQueryInfo': Before the contributions query is about to run
606 &$pager: Pager object for contributions
607 &queryInfo: The query for the contribs Pager
608
609 'ContributionsLineEnding': Called before a contributions HTML line is finished
610 $page: SpecialPage object for contributions
611 $ret: the HTML line
612 $row: the DB row for this line
613
614 'ContributionsToolLinks': Change tool links above Special:Contributions
615 $id: User identifier
616 $title: User page title
617 &$tools: Array of tool links
618
619 'CustomEditor': When invoking the page editor
620 $article: Article being edited
621 $user: User performing the edit
622
623 Return true to allow the normal editor to be used, or false
624 if implementing a custom editor, e.g. for a special namespace,
625 etc.
626
627 'DatabaseOraclePostInit': Called after initialising an Oracle database
628 &$db: the DatabaseOracle object
629
630 'NewDifferenceEngine': Called when a new DifferenceEngine object is made
631 $title: the diff page title (nullable)
632 &$oldId: the actual old Id to use in the diff
633 &$newId: the actual new Id to use in the diff (0 means current)
634 $old: the ?old= param value from the url
635 $new: the ?new= param value from the url
636
637 'DiffViewHeader': called before diff display
638 $diff: DifferenceEngine object that's calling
639 $oldRev: Revision object of the "old" revision (may be null/invalid)
640 $newRev: Revision object of the "new" revision
641
642 'DisplayOldSubtitle': before creating subtitle when browsing old versions of
643 an article
644 $article: article (object) being viewed
645 $oldid: oldid (int) being viewed
646
647 'DoEditSectionLink': Override the HTML generated for section edit links
648 $skin: Skin object rendering the UI
649 $title: Title object for the title being linked to (may not be the same as
650 $wgTitle, if the section is included from a template)
651 $section: The designation of the section being pointed to, to be included in
652 the link, like "&section=$section"
653 $tooltip: The default tooltip. Escape with htmlspecialchars() before using.
654 By default, this is wrapped in the 'editsectionhint' message.
655 &$result: The HTML to return, prefilled with the default plus whatever other
656 changes earlier hooks have made
657 $lang: The language code to use for the link in the wfMsg* functions
658
659 'EditFilter': Perform checks on an edit
660 $editor: Edit form (see includes/EditPage.php)
661 $text: Contents of the edit box
662 $section: Section being edited
663 &$error: Error message to return
664 $summary: Edit summary for page
665
666 'EditFilterMerged': Post-section-merge edit filter
667 $editor: EditPage instance (object)
668 $text: content of the edit box
669 &$error: error message to return
670 $summary: Edit summary for page
671
672 'EditFormPreloadText': Allows population of the edit form when creating
673 new pages
674 &$text: Text to preload with
675 &$title: Title object representing the page being created
676
677 'EditFormInitialText': Allows modifying the edit form when editing existing
678 pages
679 $editPage: EditPage object
680
681 'EditPage::attemptSave': called before an article is
682 saved, that is before insertNewArticle() is called
683 $editpage_Obj: the current EditPage object
684
685 'EditPage::importFormData': allow extensions to read additional data
686 posted in the form
687 $editpage: EditPage instance
688 $request: Webrequest
689 return value is ignored (should always return true)
690
691 'EditPage::showEditForm:fields': allows injection of form field into edit form
692 &$editor: the EditPage instance for reference
693 &$out: an OutputPage instance to write to
694 return value is ignored (should always return true)
695
696 'EditPage::showEditForm:initial': before showing the edit form
697 $editor: EditPage instance (object)
698
699 Return false to halt editing; you'll need to handle error messages, etc.
700 yourself. Alternatively, modifying $error and returning true will cause the
701 contents of $error to be echoed at the top of the edit form as wikitext.
702 Return true without altering $error to allow the edit to proceed.
703
704 'EditPageBeforeConflictDiff': allows modifying the EditPage object and output
705 when there's an edit conflict. Return false to halt normal diff output; in
706 this case you're responsible for computing and outputting the entire "conflict"
707 part, i.e., the "difference between revisions" and "your text" headers and
708 sections.
709 &$editor: EditPage instance
710 &$out: OutputPage instance
711
712 'EditPageBeforeEditButtons': allows modifying the edit buttons below the
713 textarea in the edit form
714 &$editpage: The current EditPage object
715 &$buttons: Array of edit buttons "Save", "Preview", "Live", and "Diff"
716 &$tabindex: HTML tabindex of the last edit check/button
717
718 'EditPageBeforeEditChecks': allows modifying the edit checks below the
719 textarea in the edit form
720 &$editpage: The current EditPage object
721 &$checks: Array of edit checks like "watch this page"/"minor edit"
722 &$tabindex: HTML tabindex of the last edit check/button
723
724 'EditPageBeforeEditToolbar': allows modifying the edit toolbar above the
725 textarea in the edit form
726 &$toolbar: The toolbar HTMl
727
728 'EditPageCopyrightWarning': Allow for site and per-namespace customization of contribution/copyright notice.
729 $title: title of page being edited
730 &$msg: localization message name, overridable. Default is either 'copyrightwarning' or 'copyrightwarning2'
731
732 'EditPageGetDiffText': Allow modifying the wikitext that will be used in
733 "Show changes"
734 $editPage: EditPage object
735 &$newtext: wikitext that will be used as "your version"
736
737 'EditPageGetPreviewText': Allow modifying the wikitext that will be previewed
738 $editPage: EditPage object
739 &$toparse: wikitext that will be parsed
740
741 'EditPageNoSuchSection': When a section edit request is given for an non-existent section
742 &$editpage: The current EditPage object
743 &$res: the HTML of the error text
744
745 'EditPageTosSummary': Give a chance for site and per-namespace customizations
746 of terms of service summary link that might exist separately from the copyright
747 notice.
748 $title: title of page being edited
749 &$msg: localization message name, overridable. Default is 'editpage-tos-summary'
750
751 'EditSectionLink': Do not use, use DoEditSectionLink instead.
752 $skin: Skin rendering the UI
753 $title: Title being linked to
754 $section: Section to link to
755 $link: Default link
756 &$result: Result (alter this to override the generated links)
757 $lang: The language code to use for the link in the wfMsg* functions
758
759 'EmailConfirmed': When checking that the user's email address is "confirmed"
760 $user: User being checked
761 $confirmed: Whether or not the email address is confirmed
762 This runs before the other checks, such as anonymity and the real check; return
763 true to allow those checks to occur, and false if checking is done.
764
765 'EmailUser': before sending email from one user to another
766 $to: address of receiving user
767 $from: address of sending user
768 $subject: subject of the mail
769 $text: text of the mail
770
771 'EmailUserCC': before sending the copy of the email to the author
772 $to: address of receiving user
773 $from: address of sending user
774 $subject: subject of the mail
775 $text: text of the mail
776
777 'EmailUserComplete': after sending email from one user to another
778 $to: address of receiving user
779 $from: address of sending user
780 $subject: subject of the mail
781 $text: text of the mail
782
783 'EmailUserForm': after building the email user form object
784 $form: HTMLForm object
785
786 'EmailUserPermissionsErrors': to retrieve permissions errors for emailing a user.
787 $user: The user who is trying to email another user.
788 $editToken: The user's edit token.
789 &$hookErr: Out-param for the error. Passed as the parameters to OutputPage::showErrorPage.
790
791 'FetchChangesList': When fetching the ChangesList derivative for
792 a particular user
793 &$user: User the list is being fetched for
794 &$skin: Skin object to be used with the list
795 &$list: List object (defaults to NULL, change it to an object
796 instance and return false override the list derivative used)
797
798 'FileDeleteComplete': When a file is deleted
799 $file: reference to the deleted file
800 $oldimage: in case of the deletion of an old image, the name of the old file
801 $article: in case all revisions of the file are deleted a reference to the
802 article associated with the file.
803 $user: user who performed the deletion
804 $reason: reason
805
806 'FileUpload': When a file upload occurs
807 $file : Image object representing the file that was uploaded
808 $reupload : Boolean indicating if there was a previously another image there or not (since 1.17)
809 $hasDescription : Boolean indicating that there was already a description page and a new one from the comment wasn't created (since 1.17)
810
811 'FileUndeleteComplete': When a file is undeleted
812 $title: title object to the file
813 $fileVersions: array of undeleted versions. Empty if all versions were restored
814 $user: user who performed the undeletion
815 $reason: reason
816
817 'FormatUserMessage': Hook to format a message if you want to override
818 the internal formatter.
819 $subject: Title of the message.
820 &$text: Text of the message.
821 $signature: Signature that they would like to leave.
822
823 'GetAutoPromoteGroups': When determining which autopromote groups a user
824 is entitled to be in.
825 &$user: user to promote.
826 &$promote: groups that will be added.
827
828 'GetBlockedStatus': after loading blocking status of an user from the database
829 $user: user (object) being checked
830
831 'GetCacheVaryCookies': get cookies that should vary cache options
832 $out: OutputPage object
833 &$cookies: array of cookies name, add a value to it if you want to add a cookie
834 that have to vary cache options
835
836 'GetFullURL': modify fully-qualified URLs used in redirects/export/offsite data
837 $title: Title object of page
838 $url: string value as output (out parameter, can modify)
839 $query: query options passed to Title::getFullURL()
840
841 'GetInternalURL': modify fully-qualified URLs used for squid cache purging
842 $title: Title object of page
843 $url: string value as output (out parameter, can modify)
844 $query: query options passed to Title::getInternalURL()
845
846 'GetIP': modify the ip of the current user (called only once)
847 &$ip: string holding the ip as determined so far
848
849 'GetLinkColours': modify the CSS class of an array of page links
850 $linkcolour_ids: array of prefixed DB keys of the pages linked to,
851 indexed by page_id.
852 &$colours: (output) array of CSS classes, indexed by prefixed DB keys
853
854 'GetLocalURL': modify local URLs as output into page links
855 $title: Title object of page
856 $url: string value as output (out parameter, can modify)
857 $query: query options passed to Title::getLocalURL()
858
859 'GetPreferences': modify user preferences
860 $user: User whose preferences are being modified.
861 &$preferences: Preferences description array, to be fed to an HTMLForm object
862
863 'getUserPermissionsErrors': Add a permissions error when permissions errors are
864 checked for. Use instead of userCan for most cases. Return false if the
865 user can't do it, and populate $result with the reason in the form of
866 array( messagename, param1, param2, ... ). For consistency, error messages
867 should be plain text with no special coloring, bolding, etc. to show that
868 they're errors; presenting them properly to the user as errors is done by
869 the caller.
870 $title: Title object being checked against
871 $user : Current user object
872 $action: Action being checked
873 $result: User permissions error to add. If none, return true.
874
875 'getUserPermissionsErrorsExpensive': Absolutely the same, but is called only
876 if expensive checks are enabled.
877
878 'ImageBeforeProduceHTML': Called before producing the HTML created by a wiki
879 image insertion. You can skip the default logic entirely by returning
880 false, or just modify a few things using call-by-reference.
881 &$skin: Skin object
882 &$title: Title object of the image
883 &$file: File object, or false if it doesn't exist
884 &$frameParams: Various parameters with special meanings; see documentation in
885 includes/Linker.php for Linker::makeImageLink2
886 &$handlerParams: Various parameters with special meanings; see documentation in
887 includes/Linker.php for Linker::makeImageLink2
888 &$time: Timestamp of file in 'YYYYMMDDHHIISS' string form, or false for current
889 &$res: Final HTML output, used if you return false
890
891
892 'ImageOpenShowImageInlineBefore': Call potential extension just before showing
893 the image on an image page
894 $imagePage: ImagePage object ($this)
895 $output: $wgOut
896
897 'ImagePageAfterImageLinks': called after the image links section on an image
898 page is built
899 $imagePage: ImagePage object ($this)
900 &$html: HTML for the hook to add
901
902 'ImagePageFileHistoryLine': called when a file history line is contructed
903 $file: the file
904 $line: the HTML of the history line
905 $css: the line CSS class
906
907 'ImagePageFindFile': called when fetching the file associated with an image page
908 $page: ImagePage object
909 &$file: File object
910 &$displayFile: displayed File object
911
912 'ImagePageShowTOC': called when the file toc on an image page is generated
913 $page: ImagePage object
914 &$toc: Array of <li> strings
915
916 'ImgAuthBeforeStream': executed before file is streamed to user, but only when
917 using img_auth.php
918 &$title: the Title object of the file as it would appear for the upload page
919 &$path: the original file and path name when img_auth was invoked by the the web
920 server
921 &$name: the name only component of the file
922 &$result: The location to pass back results of the hook routine (only used if
923 failed)
924 $result[0]=The index of the header message
925 $result[1]=The index of the body text message
926 $result[2 through n]=Parameters passed to body text message. Please note the
927 header message cannot receive/use parameters.
928
929 'ImportHandleLogItemXMLTag': When parsing a XML tag in a log item
930 $reader: XMLReader object
931 $logInfo: Array of information
932 Return false to stop further processing of the tag
933
934 'ImportHandlePageXMLTag': When parsing a XML tag in a page
935 $reader: XMLReader object
936 $pageInfo: Array of information
937 Return false to stop further processing of the tag
938
939 'ImportHandleRevisionXMLTag': When parsing a XML tag in a page revision
940 $reader: XMLReader object
941 $revInfo: Array of information
942 Return false to stop further processing of the tag
943
944 'ImportHandleToplevelXMLTag': When parsing a top level XML tag
945 $reader: XMLReader object
946 Return false to stop further processing of the tag
947
948 'ImportHandleUploadXMLTag': When parsing a XML tag in a file upload
949 $reader: XMLReader object
950 $revisionInfo: Array of information
951 Return false to stop further processing of the tag
952
953 'InitializeArticleMaybeRedirect': MediaWiki check to see if title is a redirect
954 $title: Title object ($wgTitle)
955 $request: WebRequest
956 $ignoreRedirect: boolean to skip redirect check
957 $target: Title/string of redirect target
958 $article: Article object
959
960 'InternalParseBeforeLinks': during Parser's internalParse method before links
961 but after noinclude/includeonly/onlyinclude and other processing.
962 &$parser: Parser object
963 &$text: string containing partially parsed text
964 &$stripState: Parser's internal StripState object
965
966 'InvalidateEmailComplete': Called after a user's email has been invalidated successfully
967 $user: user (object) whose email is being invalidated
968
969 'IsFileCacheable': Override the result of Article::isFileCacheable() (if true)
970 $article: article (object) being checked
971
972 'IsTrustedProxy': Override the result of wfIsTrustedProxy()
973 $ip: IP being check
974 $result: Change this value to override the result of wfIsTrustedProxy()
975
976 'isValidEmailAddr': Override the result of User::isValidEmailAddr(), for ins-
977 tance to return false if the domain name doesn't match your organization
978 $addr: The e-mail address entered by the user
979 &$result: Set this and return false to override the internal checks
980
981 'isValidPassword': Override the result of User::isValidPassword()
982 $password: The password entered by the user
983 &$result: Set this and return false to override the internal checks
984 $user: User the password is being validated for
985
986 'LanguageGetMagic': DEPRECATED, use $magicWords in a file listed in
987 $wgExtensionMessagesFiles instead.
988 Use this to define synonyms of magic words depending of the language
989 $magicExtensions: associative array of magic words synonyms
990 $lang: laguage code (string)
991
992 'LanguageGetSpecialPageAliases': DEPRECATED, use $specialPageAliases in a file
993 listed in $wgExtensionMessagesFiles instead.
994 Use to define aliases of special pages names depending of the language
995 $specialPageAliases: associative array of magic words synonyms
996 $lang: laguage code (string)
997
998 'LanguageGetTranslatedLanguageNames': Provide translated language names.
999 &$names: array of language code => language name
1000 $code language of the preferred translations
1001
1002 'LinkBegin': Used when generating internal and interwiki links in
1003 Linker::link(), before processing starts. Return false to skip default proces-
1004 sing and return $ret. See documentation for Linker::link() for details on the
1005 expected meanings of parameters.
1006 $skin: the Skin object
1007 $target: the Title that the link is pointing to
1008 &$text: the contents that the <a> tag should have (raw HTML); null means "de-
1009 fault"
1010 &$customAttribs: the HTML attributes that the <a> tag should have, in associa-
1011 tive array form, with keys and values unescaped. Should be merged with de-
1012 fault values, with a value of false meaning to suppress the attribute.
1013 &$query: the query string to add to the generated URL (the bit after the "?"),
1014 in associative array form, with keys and values unescaped.
1015 &$options: array of options. Can include 'known', 'broken', 'noclasses'.
1016 &$ret: the value to return if your hook returns false.
1017
1018 'LinkEnd': Used when generating internal and interwiki links in Linker::link(),
1019 just before the function returns a value. If you return true, an <a> element
1020 with HTML attributes $attribs and contents $text will be returned. If you re-
1021 turn false, $ret will be returned.
1022 $skin: the Skin object
1023 $target: the Title object that the link is pointing to
1024 $options: the options. Will always include either 'known' or 'broken', and may
1025 include 'noclasses'.
1026 &$text: the final (raw HTML) contents of the <a> tag, after processing.
1027 &$attribs: the final HTML attributes of the <a> tag, after processing, in asso-
1028 ciative array form.
1029 &$ret: the value to return if your hook returns false.
1030
1031 'LinkerMakeExternalImage': At the end of Linker::makeExternalImage() just
1032 before the return
1033 &$url: the image url
1034 &$alt: the image's alt text
1035 &$img: the new image HTML (if returning false)
1036
1037 'LinkerMakeExternalLink': At the end of Linker::makeExternalLink() just
1038 before the return
1039 &$url: the link url
1040 &$text: the link text
1041 &$link: the new link HTML (if returning false)
1042 &$attribs: the attributes to be applied.
1043 $linkType: The external link type
1044
1045 'LinksUpdate': At the beginning of LinksUpdate::doUpdate() just before the
1046 actual update
1047 &$linksUpdate: the LinksUpdate object
1048
1049 'LinksUpdateComplete': At the end of LinksUpdate::doUpdate() when updating has
1050 completed
1051 &$linksUpdate: the LinksUpdate object
1052
1053 'LinksUpdateConstructed': At the end of LinksUpdate() is contruction.
1054 &$linksUpdate: the LinksUpdate object
1055
1056 'ListDefinedTags': When trying to find all defined tags.
1057 &$tags: The list of tags.
1058
1059 'LoadExtensionSchemaUpdates': called during database installation and updates
1060 &updater: A DatabaseUpdater subclass
1061
1062 'LocalFile::getHistory': called before file history query performed
1063 $file: the file
1064 $tables: tables
1065 $fields: select fields
1066 $conds: conditions
1067 $opts: query options
1068 $join_conds: JOIN conditions
1069
1070 'LocalisationCacheRecache': Called when loading the localisation data into cache
1071 $cache: The LocalisationCache object
1072 $code: language code
1073 &$alldata: The localisation data from core and extensions
1074
1075 'LoginAuthenticateAudit': a login attempt for a valid user account either
1076 succeeded or failed. No return data is accepted; this hook is for auditing only.
1077 $user: the User object being authenticated against
1078 $password: the password being submitted and found wanting
1079 $retval: a LoginForm class constant with authenticateUserData() return
1080 value (SUCCESS, WRONG_PASS, etc)
1081
1082 'LogLine': Processes a single log entry on Special:Log
1083 $log_type: string for the type of log entry (e.g. 'move'). Corresponds to
1084 logging.log_type database field.
1085 $log_action: string for the type of log action (e.g. 'delete', 'block',
1086 'create2'). Corresponds to logging.log_action database field.
1087 $title: Title object that corresponds to logging.log_namespace and
1088 logging.log_title database fields.
1089 $paramArray: Array of parameters that corresponds to logging.log_params field.
1090 Note that only $paramArray[0] appears to contain anything.
1091 &$comment: string that corresponds to logging.log_comment database field, and
1092 which is displayed in the UI.
1093 &$revert: string that is displayed in the UI, similar to $comment.
1094 $time: timestamp of the log entry (added in 1.12)
1095
1096 'LogPageValidTypes': action being logged.
1097 DEPRECATED: Use $wgLogTypes
1098 &$type: array of strings
1099
1100 'LogPageLogName': name of the logging page(s).
1101 DEPRECATED: Use $wgLogNames
1102 &$typeText: array of strings
1103
1104 'LogPageLogHeader': strings used by wfMsg as a header.
1105 DEPRECATED: Use $wgLogHeaders
1106 &$headerText: array of strings
1107
1108 'LogPageActionText': strings used by wfMsg as a header.
1109 DEPRECATED: Use $wgLogActions
1110 &$actionText: array of strings
1111
1112 'MagicWordMagicWords': When defining new magic word.
1113 DEPRECATED: use $magicWords in a file listed in
1114 $wgExtensionMessagesFiles instead.
1115 $magicWords: array of strings
1116
1117 'MagicWordwgVariableIDs': When definig new magic words IDs.
1118 $variableIDs: array of strings
1119
1120 'MakeGlobalVariablesScript': called right before Skin::makeVariablesScript
1121 is executed. Ideally, this hook should only be used to add variables that
1122 depend on the current page/request; static configuration should be added
1123 through ResourceLoaderConfigVars instead.
1124 &$vars: variable (or multiple variables) to be added into the output
1125 of Skin::makeVariablesScript
1126
1127 'MarkPatrolled': before an edit is marked patrolled
1128 $rcid: ID of the revision to be marked patrolled
1129 $user: the user (object) marking the revision as patrolled
1130 $wcOnlySysopsCanPatrol: config setting indicating whether the user
1131 needs to be a sysop in order to mark an edit patrolled
1132
1133 'MarkPatrolledComplete': after an edit is marked patrolled
1134 $rcid: ID of the revision marked as patrolled
1135 $user: user (object) who marked the edit patrolled
1136 $wcOnlySysopsCanPatrol: config setting indicating whether the user
1137 must be a sysop to patrol the edit
1138
1139 'MathAfterTexvc': after texvc is executed when rendering mathematics
1140 $mathRenderer: instance of MathRenderer
1141 $errmsg: error message, in HTML (string). Nonempty indicates failure
1142 of rendering the formula
1143
1144 'MediaWikiPerformAction': Override MediaWiki::performAction().
1145 Use this to do something completely different, after the basic
1146 globals have been set up, but before ordinary actions take place.
1147 $output: $wgOut
1148 $article: $wgArticle
1149 $title: $wgTitle
1150 $user: $wgUser
1151 $request: $wgRequest
1152 $mediaWiki: The $mediawiki object
1153
1154 'MessagesPreLoad': When loading a message from the database
1155 $title: title of the message (string)
1156 $message: value (string), change it to the message you want to define
1157
1158 'MessageCacheReplace': When a message page is changed.
1159 Useful for updating caches.
1160 $title: name of the page changed.
1161 $text: new contents of the page.
1162
1163 'ModifyExportQuery': Modify the query used by the exporter.
1164 $db: The database object to be queried.
1165 &$tables: Tables in the query.
1166 &$conds: Conditions in the query.
1167 &$opts: Options for the query.
1168 &$join_conds: Join conditions for the query.
1169
1170 'MonoBookTemplateToolboxEnd': Called by Monobook skin after toolbox links have
1171 been rendered (useful for adding more)
1172 Note: this is only run for the Monobook skin. This hook is deprecated and
1173 may be removed in the future. To add items to the toolbox you should use
1174 the SkinTemplateToolboxEnd hook instead, which works for all
1175 "SkinTemplate"-type skins.
1176 $tools: array of tools
1177
1178 'BaseTemplateToolbox': Called by BaseTemplate when building the $toolbox array
1179 and returning it for the skin to output. You can add items to the toolbox while
1180 still letting the skin make final decisions on skin-specific markup conventions
1181 using this hook.
1182 &$sk: The BaseTemplate base skin template
1183 &$toolbox: An array of toolbox items, see BaseTemplate::getToolbox and
1184 BaseTemplate::makeListItem for details on the format of individual
1185 items inside of this array
1186
1187 'NewRevisionFromEditComplete': called when a revision was inserted
1188 due to an edit
1189 $article: the article edited
1190 $rev: the new revision
1191 $baseID: the revision ID this was based off, if any
1192 $user: the editing user
1193
1194 'NormalizeMessageKey': Called before the software gets the text of a message
1195 (stuff in the MediaWiki: namespace), useful for changing WHAT message gets
1196 displayed
1197 &$key: the message being looked up. Change this to something else to change
1198 what message gets displayed (string)
1199 &$useDB: whether or not to look up the message in the database (bool)
1200 &$langCode: the language code to get the message for (string) - or -
1201 whether to use the content language (true) or site language (false) (bool)
1202 &$transform: whether or not to expand variables and templates
1203 in the message (bool)
1204
1205 'OldChangesListRecentChangesLine': Customize entire Recent Changes line.
1206 &$changeslist: The OldChangesList instance.
1207 &$s: HTML of the form "<li>...</li>" containing one RC entry.
1208 &$rc: The RecentChange object.
1209
1210 'OpenSearchUrls': Called when constructing the OpenSearch description XML.
1211 Hooks can alter or append to the array of URLs for search & suggestion formats.
1212 &$urls: array of associative arrays with Url element attributes
1213
1214 'OtherBlockLogLink': Get links to the block log from extensions which blocks
1215 users and/or IP addresses too
1216 $otherBlockLink: An array with links to other block logs
1217 $ip: The requested IP address or username
1218
1219 'OutputPageBeforeHTML': a page has been processed by the parser and
1220 the resulting HTML is about to be displayed.
1221 $parserOutput: the parserOutput (object) that corresponds to the page
1222 $text: the text that will be displayed, in HTML (string)
1223
1224 'OutputPageBodyAttributes': called when OutputPage::headElement is creating the body
1225 tag to allow for extensions to add attributes to the body of the page they might
1226 need. Or to allow building extensions to add body classes that aren't of high
1227 enough demand to be included in core.
1228 $out: The OutputPage which called the hook, can be used to get the real title
1229 $sk: The Skin that called OutputPage::headElement
1230 &$bodyAttrs: An array of attributes for the body tag passed to Html::openElement
1231
1232 'OutputPageCheckLastModified': when checking if the page has been modified
1233 since the last visit
1234 &$modifiedTimes: array of timestamps.
1235 The following keys are set: page, user, epoch
1236
1237 'OutputPageParserOutput': after adding a parserOutput to $wgOut
1238 $out: OutputPage instance (object)
1239 $parserOutput: parserOutput instance being added in $out
1240
1241 'OutputPageMakeCategoryLinks': links are about to be generated for the page's
1242 categories. Implementations should return false if they generate the category
1243 links, so the default link generation is skipped.
1244 $out: OutputPage instance (object)
1245 $categories: associative array, keys are category names, values are category
1246 types ("normal" or "hidden")
1247 $links: array, intended to hold the result. Must be an associative array with
1248 category types as keys and arrays of HTML links as values.
1249
1250 'PageHistoryBeforeList': When a history page list is about to be constructed.
1251 $article: the article that the history is loading for
1252
1253 'PageHistoryLineEnding' : right before the end <li> is added to a history line
1254 $row: the revision row for this line
1255 $s: the string representing this parsed line
1256 $classes: array containing the <li> element classes
1257
1258 'PageHistoryPager::getQueryInfo': when a history pager query parameter set
1259 is constructed
1260 $pager: the pager
1261 $queryInfo: the query parameters
1262
1263 'PageRenderingHash': alter the parser cache option hash key
1264 A parser extension which depends on user options should install
1265 this hook and append its values to the key.
1266 $hash: reference to a hash key string which can be modified
1267
1268 'ParserAfterStrip': Same as ParserBeforeStrip
1269
1270 'ParserAfterTidy': Called after Parser::tidy() in Parser::parse()
1271 $parser: Parser object being used
1272 $text: text that'll be returned
1273
1274 'ParserBeforeInternalParse': called at the beginning of Parser::internalParse()
1275 $parser: Parser object
1276 $text: text to parse
1277 $stripState: StripState instance being used
1278
1279 'ParserBeforeStrip': Called at start of parsing time
1280 (no more strip, deprecated ?)
1281 $parser: parser object
1282 $text: text being parsed
1283 $stripState: stripState used (object)
1284
1285 'ParserBeforeTidy': called before tidy and custom tags replacements
1286 $parser: Parser object being used
1287 $text: actual text
1288
1289 'ParserClearState': called at the end of Parser::clearState()
1290 $parser: Parser object being cleared
1291
1292 'ParserFirstCallInit': called when the parser initialises for the first time
1293 &$parser: Parser object being cleared
1294
1295 'ParserGetVariableValueSwitch': called when the parser need the value of a
1296 custom magic word
1297 $parser: Parser object
1298 $varCache: array to store the value in case of multiples calls of the
1299 same magic word
1300 $index: index (string) of the magic
1301 $ret: value of the magic word (the hook should set it)
1302 $frame: PPFrame object to use for expanding any template variables
1303
1304 'ParserGetVariableValueTs': use this to change the value of the time for the
1305 {{LOCAL...}} magic word
1306 $parser: Parser object
1307 $time: actual time (timestamp)
1308
1309 'ParserGetVariableValueVarCache': use this to change the value of the
1310 variable cache or return false to not use it
1311 $parser: Parser object
1312 $varCache: varaiable cache (array)
1313
1314 'ParserLimitReport': called at the end of Parser:parse() when the parser will
1315 include comments about size of the text parsed
1316 $parser: Parser object
1317 $limitReport: text that will be included (without comment tags)
1318
1319 'ParserMakeImageParams': Called before the parser make an image link, use this
1320 to modify the parameters of the image.
1321 $title: title object representing the file
1322 $file: file object that will be used to create the image
1323 &$params: 2-D array of parameters
1324
1325 'ParserTestParser': called when creating a new instance of Parser in
1326 maintenance/parserTests.inc
1327 $parser: Parser object created
1328
1329 'ParserTestTables': alter the list of tables to duplicate when parser tests
1330 are run. Use when page save hooks require the presence of custom tables
1331 to ensure that tests continue to run properly.
1332 &$tables: array of table names
1333
1334 'PersonalUrls': Alter the user-specific navigation links (e.g. "my page,
1335 my talk page, my contributions" etc).
1336
1337 &$personal_urls: Array of link specifiers (see SkinTemplate.php)
1338 &$title: Title object representing the current page
1339
1340 'PingLimiter': Allows extensions to override the results of User::pingLimiter()
1341 &$user : User performing the action
1342 $action : Action being performed
1343 &$result : Whether or not the action should be prevented
1344 Change $result and return false to give a definitive answer, otherwise
1345 the built-in rate limiting checks are used, if enabled.
1346
1347 'PrefixSearchBackend': Override the title prefix search used for OpenSearch and
1348 AJAX search suggestions. Put results into &$results outparam and return false.
1349 $ns : array of int namespace keys to search in
1350 $search : search term (not guaranteed to be conveniently normalized)
1351 $limit : maximum number of results to return
1352 &$results : out param: array of page names (strings)
1353
1354 'PrefsEmailAudit': called when user changes his email address
1355 $user: User (object) changing his email address
1356 $oldaddr: old email address (string)
1357 $newaddr: new email address (string)
1358
1359 'PrefsPasswordAudit': called when user changes his password
1360 $user: User (object) changing his passoword
1361 $newPass: new password
1362 $error: error (string) 'badretype', 'wrongpassword', 'error' or 'success'
1363
1364 'ProtectionForm::buildForm': called after all protection type fieldsets are made in the form
1365 $article: the title being (un)protected
1366 $output: a string of the form HTML so far
1367
1368 'ProtectionForm::save': called when a protection form is submitted
1369 $article: the title being (un)protected
1370 $errorMsg: an html message string of an error
1371
1372 'ProtectionForm::showLogExtract': called after the protection log extract is shown
1373 $article: the page the form is shown for
1374 $out: OutputPage object
1375
1376 'ResourceLoaderRegisterModules': Right before modules information is required, such as when responding to a resource
1377 loader request or generating HTML output.
1378 &$resourceLoader: ResourceLoader object
1379
1380 'RawPageViewBeforeOutput': Right before the text is blown out in action=raw
1381 &$obj: RawPage object
1382 &$text: The text that's going to be the output
1383
1384 'RecentChange_save': called at the end of RecentChange::save()
1385 $recentChange: RecentChange object
1386
1387 'ResourceLoaderConfigVars': called at the end of
1388 ResourceLoaderStartUpModule::getConfig(). Use this to export static
1389 configuration variables to JavaScript. Things that depend on the current
1390 page/request state must be added through MakeGlobalVariablesScript instead.
1391 &$vars: array( variable name => value )
1392
1393 'RevisionInsertComplete': called after a revision is inserted into the DB
1394 &$revision: the Revision
1395 $data: the data stored in old_text. The meaning depends on $flags: if external
1396 is set, it's the URL of the revision text in external storage; otherwise,
1397 it's the revision text itself. In either case, if gzip is set, the revision
1398 text is gzipped.
1399 $flags: a comma-delimited list of strings representing the options used. May
1400 include: utf8 (this will always be set for new revisions); gzip; external.
1401
1402 'SearchUpdate': Prior to search update completion
1403 $id : Page id
1404 $namespace : Page namespace
1405 $title : Page title
1406 $text : Current text being indexed
1407
1408 'SearchGetNearMatchBefore': Perform exact-title-matches in "go" searches before the normal operations
1409 $allSearchTerms : Array of the search terms in all content languages
1410 &$titleResult : Outparam; the value to return. A Title object or null.
1411
1412 'SearchGetNearMatch': An extra chance for exact-title-matches in "go" searches if nothing was found
1413 $term : Search term string
1414 &$title : Outparam; set to $title object and return false for a match
1415
1416 'SearchGetNearMatchComplete': A chance to modify exact-title-matches in "go" searches
1417 $term : Search term string
1418 &$title : Current Title object that is being returned (null if none found).
1419
1420 'SearchEngineReplacePrefixesComplete': Run after SearchEngine::replacePrefixes().
1421 $searchEngine : The SearchEngine object. Users of this hooks will be interested
1422 in the $searchEngine->namespaces array.
1423 $query : Original query.
1424 &$parsed : Resultant query with the prefixes stripped.
1425
1426 'SearchableNamespaces': An option to modify which namespaces are searchable.
1427 &$arr : Array of namespaces ($nsId => $name) which will be used.
1428
1429 'SetupAfterCache': Called in Setup.php, after cache objects are set
1430
1431 'SetupUserMessageArticle': Called in User::leaveUserMessage() before
1432 anything has been posted to the article.
1433 $user: The user who we left the message for.
1434 &$article: The article that will be posted to.
1435 $subject: The subject of the message
1436 $text: The text of the message.
1437 $signature: The signature we used.
1438 $summary: The edit summary.
1439 $editor: The editor that performed the edit.
1440
1441 'ShowMissingArticle': Called when generating the output for a non-existent page
1442 $article: The article object corresponding to the page
1443
1444 'ShowRawCssJs': Customise the output of raw CSS and JavaScript in page views
1445 $text: Text being shown
1446 $title: Title of the custom script/stylesheet page
1447 $output: Current OutputPage object
1448
1449 'ShowSearchHitTitle': Customise display of search hit title/link.
1450 &$title: Title to link to
1451 &$text: Text to use for the link
1452 $result: The search result
1453 $terms: The search terms entered
1454 $page: The SpecialSearch object.
1455
1456 'SiteNoticeBefore': Before the sitenotice/anonnotice is composed
1457 &$siteNotice: HTML returned as the sitenotice
1458 Return true to allow the normal method of notice selection/rendering to work,
1459 or change the value of $siteNotice and return false to alter it.
1460
1461 'SiteNoticeAfter': After the sitenotice/anonnotice is composed
1462 &$siteNotice: HTML sitenotice
1463 Alter the contents of $siteNotice to add to/alter the sitenotice/anonnotice.
1464
1465 'SkinAfterBottomScripts': At the end of Skin::bottomScripts()
1466 $skin: Skin object
1467 &$text: bottomScripts Text
1468 Append to $text to add additional text/scripts after the stock bottom scripts.
1469
1470 'SkinAfterContent': Allows extensions to add text after the page content and
1471 article metadata.
1472 &$data: (string) Text to be printed out directly (without parsing)
1473 $skin: Skin object
1474 This hook should work in all skins. Just set the &$data variable to the text
1475 you're going to add.
1476
1477 'SkinBuildSidebar': At the end of Skin::buildSidebar()
1478 $skin: Skin object
1479 &$bar: Sidebar contents
1480 Modify $bar to add or modify sidebar portlets.
1481
1482 'SkinCopyrightFooter': Allow for site and per-namespace customization of copyright notice.
1483 $title: displayed page title
1484 $type: 'normal' or 'history' for old/diff views
1485 &$msg: overridable message; usually 'copyright' or 'history_copyright'. This message must be in HTML format, not wikitext!
1486 &$link: overridable HTML link to be passed into the message as $1
1487 &$forContent: overridable flag if copyright footer is shown in content language.
1488
1489 'SkinGetPoweredBy'
1490 &$text: additional 'powered by' icons in HTML.
1491 Note: Modern skin does not use the MediaWiki icon but plain text instead
1492 $skin: Skin object
1493
1494 'SkinSubPageSubtitle': At the beginning of Skin::subPageSubtitle()
1495 &$subpages: Subpage links HTML
1496 $skin: Skin object
1497 If false is returned $subpages will be used instead of the HTML
1498 subPageSubtitle() generates.
1499 If true is returned, $subpages will be ignored and the rest of
1500 subPageSubtitle() will run.
1501
1502 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink': after creating the
1503 "permanent link" tab
1504 $sktemplate: SkinTemplate object
1505 $nav_urls: array of tabs
1506
1507 Alter the structured navigation links in SkinTemplates, there are three of these hooks called in different spots.
1508 'SkinTemplateNavigation': Called on content pages after the tabs have been added but before before variants have been added
1509 'SkinTemplateNavigation::SpecialPage': Called on special pages after the special tab is added but before variants have been added
1510 'SkinTemplateNavigation::Universal': Called on both content and special pages after variants have been added
1511 &$sktemplate: SkinTemplate object
1512 &$links: Structured navigation links
1513 This is used to alter the navigation for skins which use buildNavigationUrls such as Vector.
1514
1515 'SkinTemplateOutputPageBeforeExec': Before SkinTemplate::outputPage()
1516 starts page output
1517 &$sktemplate: SkinTemplate object
1518 &$tpl: Template engine object
1519
1520 'SkinTemplatePreventOtherActiveTabs': use this to prevent showing active tabs
1521 $sktemplate: SkinTemplate object
1522 $res: set to true to prevent active tabs
1523
1524 'SkinTemplateSetupPageCss': use this to provide per-page CSS
1525 $out: Css to return
1526
1527 'SkinTemplateTabAction': Override SkinTemplate::tabAction().
1528 You can either create your own array, or alter the parameters for
1529 the normal one.
1530 &$sktemplate: The SkinTemplate instance.
1531 $title: Title instance for the page.
1532 $message: Visible label of tab.
1533 $selected: Whether this is a selected tab.
1534 $checkEdit: Whether or not the action=edit query should be added if appropriate.
1535 &$classes: Array of CSS classes to apply.
1536 &$query: Query string to add to link.
1537 &$text: Link text.
1538 &$result: Complete assoc. array if you want to return true.
1539
1540 'SkinTemplateToolboxEnd': Called by SkinTemplate skins after toolbox links have
1541 been rendered (useful for adding more)
1542 $sk: The QuickTemplate based skin template running the hook.
1543
1544 'SoftwareInfo': Called by Special:Version for returning information about
1545 the software
1546 $software: The array of software in format 'name' => 'version'.
1547 See SpecialVersion::softwareInformation()
1548
1549 'SpecialContributionsBeforeMainOutput': Before the form on Special:Contributions
1550 $id: User identifier
1551
1552 'SpecialListusersDefaultQuery': called right before the end of
1553 UsersPager::getDefaultQuery()
1554 $pager: The UsersPager instance
1555 $query: The query array to be returned
1556
1557 'SpecialListusersFormatRow': called right before the end of
1558 UsersPager::formatRow()
1559 $item: HTML to be returned. Will be wrapped in <li></li> after the hook finishes
1560 $row: Database row object
1561
1562 'SpecialListusersHeader': called before closing the <fieldset> in
1563 UsersPager::getPageHeader()
1564 $pager: The UsersPager instance
1565 $out: The header HTML
1566
1567 'SpecialListusersHeaderForm': called before adding the submit button in
1568 UsersPager::getPageHeader()
1569 $pager: The UsersPager instance
1570 $out: The header HTML
1571
1572 'SpecialListusersQueryInfo': called right before the end of
1573 UsersPager::getQueryInfo()
1574 $pager: The UsersPager instance
1575 $query: The query array to be returned
1576
1577 'SpecialMovepageAfterMove': called after moving a page
1578 $movePage: MovePageForm object
1579 $oldTitle: old title (object)
1580 $newTitle: new title (object)
1581
1582 'SpecialNewpagesConditions': called when building sql query for Special:NewPages
1583 &$special: NewPagesPager object (subclass of ReverseChronologicalPager)
1584 $opts: FormOptions object containing special page options
1585 &$conds: array of WHERE conditionals for query
1586
1587 'SpecialPage_initList': called when setting up SpecialPage::$mList, use this
1588 hook to remove a core special page
1589 $list: list (array) of core special pages
1590
1591 'SpecialRandomGetRandomTitle': called during the execution of Special:Random,
1592 use this to change some selection criteria or substitute a different title
1593 &$randstr: The random number from wfRandom()
1594 &$isRedir: Boolean, whether to select a redirect or non-redirect
1595 &$namespaces: An array of namespace indexes to get the title from
1596 &$extra: An array of extra SQL statements
1597 &$title: If the hook returns false, a Title object to use instead of the
1598 result from the normal query
1599
1600 'SpecialRecentChangesPanel': called when building form options in
1601 SpecialRecentChanges
1602 &$extraOpts: array of added items, to which can be added
1603 $opts: FormOptions for this request
1604
1605 'SpecialRecentChangesQuery': called when building sql query for
1606 SpecialRecentChanges and SpecialRecentChangesLinked
1607 &$conds: array of WHERE conditionals for query
1608 &$tables: array of tables to be queried
1609 &$join_conds: join conditions for the tables
1610 $opts: FormOptions for this request
1611 &$query_options: array of options for the database request
1612 &$select: String '*' or array of columns to select
1613
1614 'SpecialSearchGo': called when user clicked the "Go"
1615 &$title: title object generated from the text entered by the user
1616 &$term: the search term entered by the user
1617
1618 'SpecialSearchNogomatch': called when user clicked the "Go" button but the
1619 target doesn't exist
1620 &$title: title object generated from the text entered by the user
1621
1622 'SpecialSearchProfiles': allows modification of search profiles
1623 &$profiles: profiles, which can be modified.
1624
1625 'SpecialSearchResults': called before search result display when there
1626 are matches
1627 $term: string of search term
1628 &$titleMatches: empty or SearchResultSet object
1629 &$textMatches: empty or SearchResultSet object
1630
1631 'SpecialSearchNoResults': called before search result display when there are
1632 no matches
1633 $term: string of search term
1634
1635 'SpecialStatsAddExtra': add extra statistic at the end of Special:Statistics
1636 &$extraStats: Array to save the new stats
1637 ( $extraStats['<name of statistic>'] => <value>; )
1638
1639 'SpecialUploadComplete': Called after successfully uploading a file from
1640 Special:Upload
1641 $form: The SpecialUpload object
1642
1643 'SpecialVersionExtensionTypes': called when generating the extensions credits,
1644 use this to change the tables headers
1645 $extTypes: associative array of extensions types
1646
1647 'SpecialWatchlistQuery': called when building sql query for SpecialWatchlist
1648 &$conds: array of WHERE conditionals for query
1649 &$tables: array of tables to be queried
1650 &$join_conds: join conditions for the tables
1651 &$fields: array of query fields
1652
1653 'TitleArrayFromResult': called when creating an TitleArray object from a
1654 database result
1655 &$titleArray: set this to an object to override the default object returned
1656 $res: database result used to create the object
1657
1658 'TitleGetRestrictionTypes': Allows extensions to modify the types of protection
1659 that can be applied.
1660 $title: The title in question.
1661 &$types: The types of protection available.
1662
1663 'TitleMoveComplete': after moving an article (title)
1664 $old: old title
1665 $nt: new title
1666 $user: user who did the move
1667 $pageid: database ID of the page that's been moved
1668 $redirid: database ID of the created redirect
1669
1670 'UndeleteShowRevision': called when showing a revision in Special:Undelete
1671 $title: title object related to the revision
1672 $rev: revision (object) that will be viewed
1673
1674 'UnknownAction': An unknown "action" has occured (useful for defining
1675 your own actions)
1676 $action: action name
1677 $article: article "acted on"
1678
1679 'UnitTestsList': Called when building a list of files with PHPUnit tests
1680 &$files: list of files
1681
1682 'UnwatchArticle': before a watch is removed from an article
1683 $user: user watching
1684 $article: article object to be removed
1685
1686 'UnwatchArticle': after a watch is removed from an article
1687 $user: user that was watching
1688 $article: article object removed
1689
1690 'UnwatchArticleComplete': after a watch is removed from an article
1691 $user: user that watched
1692 $article: article object that was watched
1693
1694 'UploadForm:initial': before the upload form is generated
1695 $form: UploadForm object
1696 You might set the member-variables $uploadFormTextTop and
1697 $uploadFormTextAfterSummary to inject text (HTML) either before
1698 or after the editform.
1699
1700 'UploadForm:BeforeProcessing': at the beginning of processUpload()
1701 $form: UploadForm object
1702 Lets you poke at member variables like $mUploadDescription before the
1703 file is saved.
1704 Do not use this hook to break upload processing. This will return the user to
1705 a blank form with no error message; use UploadVerification and
1706 UploadVerifyFile instead
1707
1708 'UploadCreateFromRequest': when UploadBase::createFromRequest has been called
1709 $type: (string) the requested upload type
1710 &$className: the class name of the Upload instance to be created
1711
1712 'UploadComplete': when Upload completes an upload
1713 &$upload: an UploadBase child instance
1714
1715 'UploadFormInitDescriptor': after the descriptor for the upload form as been
1716 assembled
1717 $descriptor: (array) the HTMLForm descriptor
1718
1719 'UploadFormSourceDescriptors': after the standard source inputs have been
1720 added to the descriptor
1721 $descriptor: (array) the HTMLForm descriptor
1722
1723 'UploadVerification': additional chances to reject an uploaded file. Consider
1724 using UploadVerifyFile instead.
1725 string $saveName: destination file name
1726 string $tempName: filesystem path to the temporary file for checks
1727 string &$error: output: message key for message to show if upload canceled
1728 by returning false. May also be an array, where the first element
1729 is the message key and the remaining elements are used as parameters to
1730 the message.
1731
1732 'UploadVerifyFile': extra file verification, based on mime type, etc. Preferred
1733 in most cases over UploadVerification.
1734 object $upload: an instance of UploadBase, with all info about the upload
1735 string $mime: the uploaded file's mime type, as detected by MediaWiki. Handlers
1736 will typically only apply for specific mime types.
1737 object &$error: output: true if the file is valid. Otherwise, an indexed array
1738 representing the problem with the file, where the first element
1739 is the message key and the remaining elements are used as parameters to
1740 the message.
1741
1742 'UploadComplete': Upon completion of a file upload
1743 $uploadBase: UploadBase (or subclass) object. File can be accessed by
1744 $uploadBase->getLocalFile().
1745
1746 'User::mailPasswordInternal': before creation and mailing of a user's new
1747 temporary password
1748 $user: the user who sent the message out
1749 $ip: IP of the user who sent the message out
1750 $u: the account whose new password will be set
1751
1752 'UserArrayFromResult': called when creating an UserArray object from a
1753 database result
1754 &$userArray: set this to an object to override the default object returned
1755 $res: database result used to create the object
1756
1757 'userCan': To interrupt/advise the "user can do X to Y article" check.
1758 If you want to display an error message, try getUserPermissionsErrors.
1759 $title: Title object being checked against
1760 $user : Current user object
1761 $action: Action being checked
1762 $result: Pointer to result returned if hook returns false. If null is returned,
1763 userCan checks are continued by internal code.
1764
1765 'UserCanSendEmail': To override User::canSendEmail() permission check
1766 $user: User (object) whose permission is being checked
1767 &$canSend: bool set on input, can override on output
1768
1769 'UserClearNewTalkNotification': called when clearing the
1770 "You have new messages!" message, return false to not delete it
1771 $user: User (object) that'll clear the message
1772
1773 'UserComparePasswords': called when checking passwords, return false to
1774 override the default password checks
1775 &$hash: String of the password hash (from the database)
1776 &$password: String of the plaintext password the user entered
1777 &$userId: Integer of the user's ID or Boolean false if the user ID was not
1778 supplied
1779 &$result: If the hook returns false, this Boolean value will be checked to
1780 determine if the password was valid
1781
1782 'UserCreateForm': change to manipulate the login form
1783 $template: SimpleTemplate instance for the form
1784
1785 'UserCryptPassword': called when hashing a password, return false to implement
1786 your own hashing method
1787 &$password: String of the plaintext password to encrypt
1788 &$salt: String of the password salt or Boolean false if no salt is provided
1789 &$wgPasswordSalt: Boolean of whether the salt is used in the default
1790 hashing method
1791 &$hash: If the hook returns false, this String will be used as the hash
1792
1793 'UserEffectiveGroups': Called in User::getEffectiveGroups()
1794 $user: User to get groups for
1795 &$groups: Current effective groups
1796
1797 'UserGetAllRights': after calculating a list of all available rights
1798 &$rights: Array of rights, which may be added to.
1799
1800 'UserGetEmail': called when getting an user email address
1801 $user: User object
1802 &$email: email, change this to override local email
1803
1804 'UserGetEmailAuthenticationTimestamp': called when getting the timestamp of
1805 email authentification
1806 $user: User object
1807 &$timestamp: timestamp, change this to override local email authentification
1808 timestamp
1809
1810 'UserGetImplicitGroups': Called in User::getImplicitGroups()
1811 &$groups: List of implicit (automatically-assigned) groups
1812
1813 'UserGetReservedNames': allows to modify $wgReservedUsernames at run time
1814 &$reservedUsernames: $wgReservedUsernames
1815
1816 'UserGetRights': Called in User::getRights()
1817 $user: User to get rights for
1818 &$rights: Current rights
1819
1820 'UserIsBlockedFrom': Check if a user is blocked from a specific page (for specific block
1821 exemptions).
1822 $user: User in question
1823 $title: Title of the page in question
1824 &$blocked: Out-param, whether or not the user is blocked from that page.
1825 &$allowUsertalk: If the user is blocked, whether or not the block allows users to edit their
1826 own user talk pages.
1827
1828 'UserIsBlockedGlobally': Check if user is blocked on all wikis.
1829 &$user: User object
1830 $ip: User's IP address
1831 &$blocked: Whether the user is blocked, to be modified by the hook
1832
1833 'UserLoadAfterLoadFromSession': called to authenticate users on
1834 external/environmental means; occurs after session is loaded
1835 $user: user object being loaded
1836
1837 'UserLoadDefaults': called when loading a default user
1838 $user: user object
1839 $name: user name
1840
1841 'UserLoadFromDatabase': called when loading a user from the database
1842 $user: user object
1843 &$s: database query object
1844
1845 'UserLoadFromSession': called to authenticate users on external/environmental
1846 means; occurs before session is loaded
1847 $user: user object being loaded
1848 &$result: set this to a boolean value to abort the normal authentification
1849 process
1850
1851 'UserLoadOptions': when user options/preferences are being loaded from
1852 the database.
1853 $user: User object
1854 &$options: Options, can be modified.
1855
1856 'UserLoginComplete': after a user has logged in
1857 $user: the user object that was created on login
1858 $inject_html: Any HTML to inject after the "logged in" message.
1859
1860 'UserLoginForm': change to manipulate the login form
1861 $template: SimpleTemplate instance for the form
1862
1863 'UserLoginMailPassword': Block users from emailing passwords
1864 $name: the username to email the password of.
1865 &$error: out-param - the error message to return.
1866
1867 'UserLogout': before a user logs out
1868 $user: the user object that is about to be logged out
1869
1870 'UserLogoutComplete': after a user has logged out
1871 $user: the user object _after_ logout (won't have name, ID, etc.)
1872 $inject_html: Any HTML to inject after the "logged out" message.
1873 $oldName: name of the user before logout (string)
1874
1875 'UserRights': After a user's group memberships are changed
1876 $user : User object that was changed
1877 $add : Array of strings corresponding to groups added
1878 $remove: Array of strings corresponding to groups removed
1879
1880 'UserRetrieveNewTalks': called when retrieving "You have new messages!"
1881 message(s)
1882 $user: user retrieving new talks messages
1883 $talks: array of new talks page(s)
1884
1885 'UserSaveSettings': called when saving user settings
1886 $user: User object
1887
1888 'UserSaveOptions': Called just before saving user preferences/options.
1889 $user: User object
1890 &$options: Options, modifiable
1891
1892 'UserSetCookies': called when setting user cookies
1893 $user: User object
1894 &$session: session array, will be added to $_SESSION
1895 &$cookies: cookies array mapping cookie name to its value
1896
1897 'UserSetEmail': called when changing user email address
1898 $user: User object
1899 &$email: new email, change this to override new email address
1900
1901 'UserSetEmailAuthenticationTimestamp': called when setting the timestamp
1902 of email authentification
1903 $user: User object
1904 &$timestamp: new timestamp, change this to override local email
1905 authentification timestamp
1906
1907 'WantedPages::getQueryInfo': called in WantedPagesPage::getQueryInfo(), can be
1908 used to alter the SQL query which gets the list of wanted pages
1909 &$wantedPages: WantedPagesPage object
1910 &$query: query array, see QueryPage::getQueryInfo() for format documentation
1911
1912 'WatchArticle': before a watch is added to an article
1913 $user: user that will watch
1914 $article: article object to be watched
1915
1916 'WatchArticleComplete': after a watch is added to an article
1917 $user: user that watched
1918 $article: article object watched
1919
1920 'WatchlistEditorBuildRemoveLine': when building remove lines in
1921 Special:Watchlist/edit
1922 &$tools: array of extra links
1923 $title: Title object
1924 $redirect: whether the page is a redirect
1925 $skin: Skin object
1926
1927 'WikiExporter::dumpStableQuery': Get the SELECT query for "stable" revisions
1928 dumps
1929 One, and only one hook should set this, and return false.
1930 &$tables: Database tables to use in the SELECT query
1931 &$opts: Options to use for the query
1932 &$join: Join conditions
1933
1934 'wgQueryPages': called when initialising $wgQueryPages, use this to add new
1935 query pages to be updated with maintenance/updateSpecialPages.php
1936 $query: $wgQueryPages itself
1937
1938 'XmlDumpWriterOpenPage': Called at the end of XmlDumpWriter::openPage, to allow extra
1939 metadata to be added.
1940 $obj: The XmlDumpWriter object.
1941 &$out: The output string.
1942 $row: The database row for the page.
1943 $title: The title of the page.
1944
1945 'XmlDumpWriterWriteRevision': Called at the end of a revision in an XML dump, to add extra
1946 metadata.
1947 $obj: The XmlDumpWriter object.
1948 &$out: The text being output.
1949 $row: The database row for the revision.
1950 $text: The revision text.
1951
1952 More hooks might be available but undocumented, you can execute
1953 ./maintenance/findhooks.php to find hidden one.