New hook point to exempt an IP address from the account creation throttle. Redo of...
[lhc/web/wiklou.git] / docs / hooks.txt
index 63c8ef3..0ee7e6f 100644 (file)
@@ -295,6 +295,17 @@ before showing the edit form ( EditPage::edit() ). This is triggered
 on &action=edit.
 $EditPage: the EditPage object
 
+'AlternateUserMailer': Called before mail is sent so that mail could
+be logged (or something else) instead of using PEAR or PHP's mail().
+Return false to skip the regular method of sending mail.  Return a
+string to return a php-mail-error message containing the error.
+Returning true will continue with sending email in the regular way.
+$headers: Associative array of headers for the email
+$to: MailAddress object or array
+$from: From address
+$subject: Subject of the email
+$body: Body of the message
+
 'APIAfterExecute': after calling the execute() method of an API module.
 Use this to extend core API modules.
 &$module: Module object
@@ -397,32 +408,32 @@ Use this to change the content in this area or how it is loaded.
  $output: the OutputPage object ($wgOut)
 
 'ArticleDelete': before an article is deleted
-$article: the article (object) being deleted
+$article: the WikiPage (object) being deleted
 $user: the user (object) deleting the article
 $reason: the reason (string) the article is being deleted
 $error: if the deletion was prohibited, the (raw HTML) error message to display
   (added in 1.13)
 
 'ArticleDeleteComplete': after an article is deleted
-$article: the article that was deleted
+$article: the WikiPage that was deleted
 $user: the user that deleted the article
 $reason: the reason the article was deleted
 $id: id of the article that was deleted
 
 'ArticleEditUpdateNewTalk': before updating user_newtalk when a user talk page
 was changed
-$article: article (object) of the user talk page
+$article: WikiPage (object) of the user talk page
 
 'ArticleEditUpdates': when edit updates (mainly link tracking) are made when an
 article has been changed
-$article: the article (object)
+$article: the WikiPage (object)
 $editInfo: data holder that includes the parser output ($editInfo->output) for
 that page after the change
 $changed: bool for if the page was changed
 
 'ArticleEditUpdatesDeleteFromRecentchanges': before deleting old entries from
 recentchanges table, return false to not delete old entries
-$article: article (object) being modified
+$article: WikiPage (object) being modified
 
 'ArticleFromTitle': when creating an article object from a title object using
 Wiki::articleFromTitle()
@@ -430,7 +441,7 @@ $title: title (object) used to create the article object
 $article: article (object) that will be returned
 
 'ArticleInsertComplete': After a new article is created
-$article: Article created
+$article: WikiPage created
 $user: User creating the article
 $text: New content
 $summary: Edit summary/comment
@@ -445,33 +456,33 @@ $targetTitle: target title (object)
 $destTitle: destination title (object)
 
 'ArticlePageDataAfter': after loading data of an article from the database
-$article: article (object) whose data were loaded
+$article: WikiPage (object) whose data were loaded
 $row: row (object) returned from the database server
 
 'ArticlePageDataBefore': before loading data of an article from the database
-$article: article (object) that data will be loaded
+$article: WikiPage (object) that data will be loaded
 $fields: fileds (array) to load from the database
 
 'ArticlePrepareTextForEdit': called when preparing text to be saved
-$article: the article being saved
+$article: the WikiPage being saved
 $popts: parser options to be used for pre-save transformation
 
 'ArticleProtect': before an article is protected
-$article: the article being protected
+$article: the WikiPage being protected
 $user: the user doing the protection
 $protect: boolean whether this is a protect or an unprotect
 $reason: Reason for protect
 $moveonly: boolean whether this is for move only or not
 
 'ArticleProtectComplete': after an article is protected
-$article: the article that was protected
+$article: the WikiPage that was protected
 $user: the user who did the protection
 $protect: boolean whether it was a protect or an unprotect
 $reason: Reason for protect
 $moveonly: boolean whether it was for move only or not
 
 'ArticlePurge': before executing "&action=purge"
-$article: article (object) to purge
+$article: WikiPage (object) to purge
 
 'ArticleRevisionVisibilitySet': called when changing visibility of one or more
 revision of an article
@@ -483,13 +494,13 @@ $revision: the revision
 $oldPageID: the page ID of the revision when archived (may be null)
 
 'ArticleRollbackComplete': after an article rollback is completed
-$article: the article that was edited
+$article: the WikiPage that was edited
 $user: the user who did the rollback
 $revision: the revision the page was reverted back to
 $current: the reverted revision
 
 'ArticleSave': before an article is saved
-$article: the article (object) being saved
+$article: the WikiPage (object) being saved
 $user: the user (object) saving the article
 $text: the new article text
 $summary: the article summary (comment)
@@ -498,7 +509,7 @@ $iswatch: watch flag
 $section: section #
 
 'ArticleSaveComplete': After an article has been updated
-$article: Article modified
+$article: WikiPage modified
 $user: User performing the modification
 $text: New content
 $summary: Edit summary/comment
@@ -534,6 +545,11 @@ viewing.
 follwed an redirect
 $article: target article (object)
 
+'ArticleViewCustom': allows to output the text of the article in a different format than wikitext
+$text: text of the page
+$title: title of the page
+$output: reference to $wgOut
+
 'AuthPluginAutoCreate': Called when creating a local account for an user logged
 in from an external authentication method
 $user: User object created locally
@@ -548,6 +564,16 @@ $args: arguments
 $user: user
 $result: result of checking autopromote condition
 
+'BacklinkCacheGetPrefix': allows to set prefix for a spefific link table
+$table: table name
+&$prefix: prefix
+
+'BacklinkCacheGetConditions': allows to set conditions for query when links to certain title
+are fetched
+$table: table name
+$title: title of the page to which backlinks are sought
+&$conds: query conditions
+
 'BadImage': When checking against the bad image list
 $name: Image name being checked
 &$bad: Whether or not the image is "bad"
@@ -595,6 +621,10 @@ $image: File
 &$scalerParams: Array with scaler parameters 
 &$mto: null, set to a MediaTransformOutput
 
+'PerformRetroactiveAutoblock': called before a retroactive autoblock is applied to a user
+$block: Block object (which is set to be autoblocking)
+&$blockIds: Array of block IDs of the autoblock
+
 'BlockIp': before an IP address or user is blocked
 $block: the Block object about to be saved
 $user: the user _doing_ the block (not the one being blocked)
@@ -621,12 +651,17 @@ $catpage: CategoryPage instance
 $unpatrolled:  Whether or not we are showing unpatrolled changes.
 $watched:      Whether or not the change is watched by the user.
 
+'Collation::factory': Called if $wgCategoryCollation is an unknown collation
+$collationName: Name of the collation in question
+&$collationObject: Null. Replace with a subclass of the Collation class that implements
+the collation given in $collationName.
+
 'ConfirmEmailComplete': Called after a user's email has been confirmed successfully
 $user: user (object) whose email is being confirmed
 
 'ContribsPager::getQueryInfo': Before the contributions query is about to run
 &$pager: Pager object for contributions
-&queryInfo: The query for the contribs Pager
+&$queryInfo: The query for the contribs Pager
 
 'ContributionsLineEnding': Called before a contributions HTML line is finished
 $page: SpecialPage object for contributions
@@ -814,6 +849,9 @@ $user: The user who is trying to email another user.
 $editToken: The user's edit token.
 &$hookErr: Out-param for the error. Passed as the parameters to OutputPage::showErrorPage.
 
+'exemptFromAccountCreationThrottle': Exemption from the account creation throttle
+$ip: The ip address of the user
+
 'ExtensionTypes': called when generating the extensions credits, use this to change the tables headers
 &$extTypes: associative array of extensions types
 
@@ -856,6 +894,15 @@ $out: OutputPage object
 &$cookies: array of cookies name, add a value to it if you want to add a cookie
        that have to vary cache options
 
+'GetCanonicalURL': modify fully-qualified URLs used for IRC and e-mail notifications
+$title: Title object of page
+$url: string value as output (out parameter, can modify)
+$query: query options passed to Title::getCanonicalURL()
+
+'GetDefaultSortkey': Override the default sortkey for a page.
+$title: Title object that we need to get a sortkey for
+&$sortkey: Sortkey to use.
+
 'GetFullURL': modify fully-qualified URLs used in redirects/export/offsite data
 $title: Title object of page
 $url: string value as output (out parameter, can modify)
@@ -874,10 +921,27 @@ $linkcolour_ids: array of prefixed DB keys of the pages linked to,
        indexed by page_id.
 &$colours: (output) array of CSS classes, indexed by prefixed DB keys
 
-'GetLocalURL': modify local URLs as output into page links
+'GetLocalURL': modify local URLs as output into page links. Note that if you
+       are working with internal urls (non-interwiki) then it may be preferable
+       to work with the GetLocalURL::Internal or GetLocalURL::Article hooks as
+       GetLocalURL can be buggy for internal urls on render if you do not
+       re-implement the horrible hack that Title::getLocalURL uses
+       in your own extension.
 $title: Title object of page
-$url: string value as output (out parameter, can modify)
+&$url: string value as output (out parameter, can modify)
 $query: query options passed to Title::getLocalURL()
+$variant: variant options passed to Title::getLocalURL()
+
+'GetLocalURL::Internal': modify local URLs to internal pages.
+$title: Title object of page
+&$url: string value as output (out parameter, can modify)
+$query: query options passed to Title::getLocalURL()
+$variant: variant options passed to Title::getLocalURL()
+
+'GetLocalURL::Article': modify local URLs specifically pointing to article paths
+       without any fancy queries or variants.
+$title: Title object of page
+&$url: string value as output (out parameter, can modify)
 
 'GetMetadataVersion': modify the image metadata version currently in use. This is
        used when requesting image metadata from a ForiegnApiRepo. Media handlers
@@ -1003,6 +1067,11 @@ but after noinclude/includeonly/onlyinclude and other processing.
 'InvalidateEmailComplete': Called after a user's email has been invalidated successfully
 $user: user (object) whose email is being invalidated
 
+'IRCLineURL': When constructing the URL to use in an IRC notification.
+Callee may modify $url and $query, URL will be constructed as $url . $query
+&$url: URL to index.php
+&$query: Query string
+
 'IsFileCacheable': Override the result of Article::isFileCacheable() (if true)
 $article: article (object) being checked
 
@@ -1205,7 +1274,7 @@ using this hook.
 
 'NewRevisionFromEditComplete': called when a revision was inserted
 due to an edit
-$article: the article edited
+$article: the WikiPage edited
 $rev: the new revision
 $baseID: the revision ID this was based off, if any
 $user: the editing user
@@ -1266,6 +1335,12 @@ $categories: associative array, keys are category names, values are category
 $links: array, intended to hold the result. Must be an associative array with
        category types as keys and arrays of HTML links as values.
 
+'PageContentLanguage': allows changing the language in which the content of
+a page is written. Defaults to the wiki content language ($wgContLang).
+$title: Title object
+&$pageLang: the page content language (either an object or a language code)
+$wgLang: the user language
+
 'PageHistoryBeforeList': When a history page list is about to be constructed.
 $article: the article that the history is loading for
 
@@ -1341,6 +1416,17 @@ $title: title object representing the file
 $file: file object that will be used to create the image
 &$params: 2-D array of parameters
 
+'ParserSectionCreate': Called each time the parser creates a document section
+from wikitext.  Use this to apply per-section modifications to HTML (like
+wrapping the section in a DIV).  Caveat: DIVs are valid wikitext, and a DIV
+can begin in one section and end in another.  Make sure your code can handle
+that case gracefully.  See the EditSectionClearerLink extension for an
+example.
+$parser: the calling Parser instance
+$section: the section number, zero-based, but section 0 is usually empty
+&$sectionContent: ref to the content of the section. modify this.
+$showEditLinks: boolean describing whether this section has an edit link
+
 'ParserTestParser': called when creating a new instance of Parser in
 maintenance/parserTests.inc
 $parser: Parser object created
@@ -1538,9 +1624,6 @@ starts page output
 $sktemplate: SkinTemplate object
 $res: set to true to prevent active tabs
 
-'SkinTemplateSetupPageCss': use this to provide per-page CSS
-$out: Css to return
-
 'SkinTemplateTabAction': Override SkinTemplate::tabAction().
 You can either create your own array, or alter the parameters for
 the normal one.
@@ -1713,6 +1796,15 @@ $res: database result used to create the object
 $title: The title in question.
 &$types: The types of protection available.
 
+'TitleIsCssOrJsPage': Called when determining if a page is a CSS or JS page
+$title: Title object that is being checked
+$result: Boolean; whether MediaWiki currently thinks this is a CSS/JS page. Hooks may change this value to override the return value of Title::isCssOrJsPage()
+
+'TitleIsWikitextPage': Called when determining if a page is a wikitext or should
+be handled by seperate handler (via ArticleViewCustom)
+$title: Title object that is being checked
+$result: Boolean; whether MediaWiki currently thinks this is a wikitext page. Hooks may change this value to override the return value of Title::isWikitextPage()
+
 'TitleMoveComplete': after moving an article (title)
 $old: old title
 $nt: new title
@@ -2004,6 +2096,15 @@ $title: Title object
 $redirect: whether the page is a redirect
 $skin: Skin object
 
+'WebRequestGetPathInfoRequestURI': while extracting path info from REQUEST_URI.
+       Allows an extension to extend the extraction of titles from paths.
+       Implementing hooks should follow the pattern used in core:
+       * Use the `$matches = WebRequest::extractTitle` pattern
+       * Ensure that you test `if ( !$matches ) {` before you try extracting a title
+         from the path so that you don't override an already found match.
+$path: The request path to extract a title from.
+&$matches: The array to apply matches to.
+
 'WikiExporter::dumpStableQuery': Get the SELECT query for "stable" revisions
 dumps
 One, and only one hook should set this, and return false.