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