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