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