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