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