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