Merge "Added new MWTimestamp::getRelativeTimestamp for pure relative."
[lhc/web/wiklou.git] / docs / hooks.txt
index 1a1a454..94e94cf 100644 (file)
@@ -270,6 +270,10 @@ $reason: the reason for the move (added in 1.13)
 $user: the User object about to be created (read-only, incomplete)
 &$msg: out parameter: HTML to display on abort
 
+'AbortTalkPageEmailNotification': Return false to cancel talk page email notification
+$targetUser: the user whom to send talk page email notification
+$title: the page title
+
 'AbortChangePassword': Return false to cancel password change.
 $user: the User object to which the password change is occuring
 $mOldpass: the old password provided by the user
@@ -615,6 +619,7 @@ the user is redirected back to the page.
 
 'ArticleViewFooter': After showing the footer section of an ordinary page view
 $article: Article object
+$patrolFooterShown: boolean whether patrol footer is shown
 
 'ArticleViewHeader': Before the parser cache is about to be tried for article
 viewing.
@@ -753,8 +758,22 @@ $user: the user who did the block (not the one being blocked)
 $isbn: ISBN to show information for
 $output: OutputPage object in use
 
+'CanIPUseHTTPS': Determine whether the client at a given source IP is likely
+to be able to access the wiki via HTTPS.
+$ip: The IP address in human-readable form
+&$canDo: This reference should be set to false if the client may not be able 
+to use HTTPS
+
 'CanonicalNamespaces': For extensions adding their own namespaces or altering
 the defaults.
+Note that if you need to specify namespace protection or content model for
+a namespace that is added in a CanonicalNamespaces hook handler, you
+should do so by altering $wgNamespaceProtection and
+$wgNamespaceContentModels outside the handler, in top-level scope. The
+point at which the CanonicalNamespaces hook fires is too late for altering
+these variables. This applies even if the namespace addition is
+conditional; it is permissible to declare a content model and protection
+for a namespace and then decline to actually register it.
 &$namespaces: Array of namespace numbers with corresponding canonical names
 
 'CategoryAfterPageAdded': After a page is added to a category.
@@ -1014,14 +1033,6 @@ notice.
 $title: title of page being edited
 &$msg: localization message name, overridable. Default is 'editpage-tos-summary'
 
-'EditSectionLink': Do not use, use DoEditSectionLink instead.
-$skin: Skin rendering the UI
-$title: Title being linked to
-$section: Section to link to
-$link: Default link
-&$result: Result (alter this to override the generated links)
-$lang: The language code to use for the link in the wfMessage function
-
 'EmailConfirmed': When checking that the user's email address is "confirmed".
 $user: User being checked
 $confirmed: Whether or not the email address is confirmed
@@ -1112,6 +1123,12 @@ $reason: reason
  $title: An optional title object used to links to sections. Can be null.
  $local: Boolean indicating whether section links should refer to local page.
 
+'GalleryGetModes': Get list of classes that can render different modes of a
+ gallery
+$modeArray: An associative array mapping mode names to classes that implement
+ that mode. It is expected all registered classes are a subclass of
+ ImageGalleryBase.
+
 'GetAutoPromoteGroups': When determining which autopromote groups a user is
 entitled to be in.
 &$user: user to promote.
@@ -1373,6 +1390,10 @@ $article: article (object) being checked
 $ip: IP being check
 $result: Change this value to override the result of wfIsTrustedProxy()
 
+'IsUploadAllowedFromUrl': Override the result of UploadFromUrl::isAllowedUrl()
+$url: URL used to upload from
+&$allowed: Boolean indicating if uploading is allowed for given URL
+
 'isValidEmailAddr': Override the result of User::isValidEmailAddr(), for
 instance to return false if the domain name doesn't match your organization.
 $addr: The e-mail address entered by the user
@@ -1803,10 +1824,29 @@ cache or return false to not use it.
 $parser: Parser object
 $varCache: variable cache (array)
 
-'ParserLimitReport': Called at the end of Parser:parse() when the parser will
+'ParserLimitReport': DEPRECATED, use ParserLimitReportPrepare and
+ParserLimitReportFormat instead.
+Called at the end of Parser:parse() when the parser will
 include comments about size of the text parsed.
 $parser: Parser object
-$limitReport: text that will be included (without comment tags)
+&$limitReport: text that will be included (without comment tags)
+
+'ParserLimitReportFormat': Called for each row in the parser limit report that
+needs formatting. If nothing handles this hook, the default is to use "$key" to
+get the label, and "$key-value" or "$key-value-text"/"$key-value-html" to
+format the value.
+$key: Key for the limit report item (string)
+$value: Value of the limit report item
+&$report: String onto which to append the data
+$isHTML: If true, $report is an HTML table with two columns; if false, it's
+       text intended for display in a monospaced font.
+$localize: If false, $report should be output in English.
+
+'ParserLimitReportPrepare': Called at the end of Parser:parse() when the parser will
+include comments about size of the text parsed. Hooks should use
+$output->setLimitReportData() to populate data.
+$parser: Parser object
+$output: ParserOutput object
 
 'ParserMakeImageParams': Called before the parser make an image link, use this
 to modify the parameters of the image.
@@ -1826,7 +1866,7 @@ $section: the section number, zero-based, but section 0 is usually empty
 $showEditLinks: boolean describing whether this section has an edit link
 
 'ParserTestParser': Called when creating a new instance of Parser in
-maintenance/parserTests.inc.
+tests/parser/parserTest.inc.
 $parser: Parser object created
 
 'ParserTestGlobals': Allows to define globals for parser tests.
@@ -1849,6 +1889,7 @@ $action : Action being performed
 &$result : Whether or not the action should be prevented
 Change $result and return false to give a definitive answer, otherwise
 the built-in rate limiting checks are used, if enabled.
+$incrBy: Amount to increment counter by
 
 'PlaceNewSection': Override placement of new sections. Return false and put the
 merged text into $text to override the default behavior.
@@ -1886,9 +1927,10 @@ $article: the title being (un)protected
 $output: a string of the form HTML so far
 
 'ProtectionForm::save': Called when a protection form is submitted.
-$article: the title being (un)protected
-$errorMsg: an html message string of an error or an array of message name and
+$article: the Page being (un)protected
+&$errorMsg: an html message string of an error or an array of message name and
   its parameters
+$reasonstr: a string describing the reason page protection level is altered
 
 'ProtectionForm::showLogExtract': Called after the protection log extract is
 shown.
@@ -1914,6 +1956,10 @@ IContextSource $context: The RequestContext the skin is being created for.
 &$skin: A variable reference you may set a Skin instance or string key on to
   override the skin that will be used for the context.
 
+'ResetSessionID': Called from wfResetSessionID
+$oldSessionID: old session id
+$newSessionID: new session id
+
 'ResourceLoaderGetConfigVars': Called at the end of
 ResourceLoaderStartUpModule::getConfig(). Use this to export static
 configuration variables to JavaScript. Things that depend on the current page
@@ -1954,12 +2000,6 @@ $data: the data stored in old_text.  The meaning depends on $flags: if external
 $flags: a comma-delimited list of strings representing the options used.  May
   include: utf8 (this will always be set for new revisions); gzip; external.
 
-'SearchUpdate': Prior to search update completion.
-$id : Page id
-$namespace : Page namespace
-$title : Page title
-$text : Current text being indexed
-
 'SearchGetNearMatchBefore': Perform exact-title-matches in "go" searches before
 the normal operations.
 $allSearchTerms : Array of the search terms in all content languages
@@ -1995,8 +2035,6 @@ $title : Current Title object being displayed in search results.
 'SearchableNamespaces': An option to modify which namespaces are searchable.
 &$arr : Array of namespaces ($nsId => $name) which will be used.
 
-'SeleniumSettings': TODO
-
 'SetupAfterCache': Called in Setup.php, after cache objects are set
 
 'ShowMissingArticle': Called when generating the output for a non-existent page.
@@ -2121,8 +2159,6 @@ $checkEdit: Whether or not the action=edit query should be added if appropriate.
 &$text: Link text.
 &$result: Complete assoc. array if you want to return true.
 
-'SkinTemplateTabs': TODO
-
 'SkinTemplateToolboxEnd': Called by SkinTemplate skins after toolbox links have
 been rendered (useful for adding more).
 $sk: The QuickTemplate based skin template running the hook.
@@ -2234,6 +2270,11 @@ $opts: FormOptions for this request
 &$query_options: array of options for the database request
 &$select: Array of columns to select
 
+'SpecialResetTokensTokens': Called when building token list for
+SpecialResetTokens.
+&$tokens: array of token information arrays in the format of
+  array( 'preference' => '<preference-name>', 'label-message' => '<message-key>' )
+
 'SpecialSearchCreateLink': Called when making the message to create a page or
 go to the existing page.
 $t: title object searched for
@@ -2342,6 +2383,20 @@ database result.
 &$titleArray: set this to an object to override the default object returned
 $res: database result used to create the object
 
+'TitleQuickPermissions': Called from Title::checkQuickPermissions to add to
+or override the quick permissions check.
+$title: The Title object being accessed
+$user: The User performing the action
+$action: Action being performed
+&$errors: Array of errors
+$doExpensiveQueries: Whether to do expensive DB queries
+$short: Whether to return immediately on first error
+
+'TitleGetEditNotices': Allows extensions to add edit notices
+$title: The Title object for the page the edit notices are for
+$oldid: Revision ID that the edit notices are for (or 0 for latest)
+&$notices: Array of notices. Keys are i18n message keys, values are parseAsBlock()ed messages.
+
 'TitleGetRestrictionTypes': Allows extensions to modify the types of protection
 that can be applied.
 $title: The title in question.
@@ -2375,6 +2430,11 @@ $result: Boolean; whether MediaWiki currently thinks this is a wikitext page.
   Hooks may change this value to override the return value of
   Title::isWikitextPage()
 
+'TitleMove': Before moving an article (title).
+$old: old title
+$nt: new title
+$user: user who does the move
+
 'TitleMoveComplete': After moving an article (title).
 $old: old title
 $nt: new title
@@ -2425,6 +2485,7 @@ $article: article "acted on"
 'UnwatchArticle': Before a watch is removed from an article.
 $user: user watching
 $page: WikiPage object to be removed
+&$status: Status object to be returned if the hook returns false
 
 'UnwatchArticleComplete': After a watch is removed from an article.
 $user: user that watched
@@ -2585,6 +2646,10 @@ $title: Title of the page in question
 $ip: User's IP address
 &$blocked: Whether the user is blocked, to be modified by the hook
 
+'UserIsEveryoneAllowed': Check if all users are allowed some user right; return
+false if a UserGetRights hook might remove the named right.
+$right: The user right being checked
+
 'UserLoadAfterLoadFromSession': Called to authenticate users on external or
 environmental means; occurs after session is loaded.
 $user: user object being loaded
@@ -2633,6 +2698,12 @@ $user  : User object that was changed
 $add   : Array of strings corresponding to groups added
 $remove: Array of strings corresponding to groups removed
 
+'UserRequiresHTTPS': Called to determine whether a user needs
+to be switched to HTTPS.
+$user: User in question.
+&$https: Boolean whether $user should be switched to HTTPS.
+
+
 'UserRetrieveNewTalks': Called when retrieving "You have new messages!"
 message(s).
 $user: user retrieving new talks messages
@@ -2674,6 +2745,7 @@ used to alter the SQL query which gets the list of wanted pages.
 'WatchArticle': Before a watch is added to an article.
 $user: user that will watch
 $page: WikiPage object to be watched
+&$status: Status object to be returned if the hook returns false
 
 'WatchArticleComplete': After a watch is added to an article.
 $user: user that watched
@@ -2690,6 +2762,13 @@ $skin: Skin object
 REQUEST_URI.
 $router: The PathRouter instance
 
+'WebResponseSetCookie': when setting a cookie in WebResponse::setcookie().
+Return false to prevent setting of the cookie.
+&$name: Cookie name passed to WebResponse::setcookie()
+&$value: Cookie value passed to WebResponse::setcookie()
+&$expire: Cookie expiration, as for PHP's setcookie()
+$options: Options passed to WebResponse::setcookie()
+
 'WikiExporter::dumpStableQuery': Get the SELECT query for "stable" revisions
 dumps. One, and only one hook should set this, and return false.
 &$tables: Database tables to use in the SELECT query