Localisation updates for core and extension messages from translatewiki.net
[lhc/web/wiklou.git] / docs / hooks.txt
index abe40a7..d33bd7a 100644 (file)
@@ -296,8 +296,10 @@ 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 SMTP
-$UserMailer: the EditPage object
+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
@@ -516,6 +518,7 @@ $isWatch: (No longer used)
 $section: (No longer used)
 $flags: Flags passed to Article::doEdit()
 $revision: New Revision of the article
+$status: Status object about to be returned by doEdit()
 $baseRevId: the rev ID (or false) this edit was based on
 
 'ArticleUndelete': When one or more revisions of an article are restored
@@ -537,12 +540,18 @@ $article: Article object
 viewing.
 &$article: the article
 &$pcache: whether to try the parser cache or not
-&$outputDone: whether the output for this page finished or not
+&$outputDone: whether the output for this page finished or not. Set to a ParserOutput
+object to both indicate that the output is done and what parser output was used.
 
 'ArticleViewRedirect': before setting "Redirected from ..." subtitle when
 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
@@ -557,6 +566,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"
@@ -579,10 +598,11 @@ $mediaWiki: Mediawiki object
 'BeforeParserFetchFileAndTitle': before an image is rendered by Parser
 $parser: Parser object
 $nt: the image title
-&$time: the image timestamp (use '0' to force a broken thumbnail)
-&$sha1: image base 36 sha1 (used to specify the file, $nt will be ignored if this is set)
+&$options: array of options to RepoGroup::findFile
 &$descQuery: query string to add to thumbnail URL
 
+If 'broken' is a key in $options then the file will appear as a broken thumbnail.
+
 'BeforeParserFetchTemplateAndtitle': before a template is fetched by Parser
 $parser: Parser object
 $title: title of the template
@@ -644,7 +664,7 @@ $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
@@ -739,7 +759,6 @@ return value is ignored (should always return true)
 
 'EditPage::showEditForm:initial': before showing the edit form
 $editor: EditPage instance (object)
-$formCallback: Array for callback of modifying the edit form
 
 Return false to halt editing; you'll need to handle error messages, etc.
 yourself. Alternatively, modifying $error and returning true will cause the
@@ -833,6 +852,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
 
@@ -875,6 +897,12 @@ $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()
+$variant: variant 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.
@@ -883,11 +911,13 @@ $title: Title object that we need to get a sortkey for
 $title: Title object of page
 $url: string value as output (out parameter, can modify)
 $query: query options passed to Title::getFullURL()
+$variant: variant passed to Title::getFullURL()
 
 'GetInternalURL': modify fully-qualified URLs used for squid cache purging
 $title: Title object of page
 $url: string value as output (out parameter, can modify)
 $query: query options passed to Title::getInternalURL()
+$variant: variant passed to Title::getFullURL()
 
 'GetIP': modify the ip of the current user (called only once)
 &$ip: string holding the ip as determined so far
@@ -897,10 +927,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 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 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
@@ -1026,6 +1073,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
 
@@ -1043,6 +1095,11 @@ $password: The password entered by the user
 &$result: Set this and return false to override the internal checks
 $user: User the password is being validated for
 
+'LanguageGetNamespaces': Provide custom ordering for namespaces or
+remove namespaces. Do not use this hook to add namespaces. Use 
+CanonicalNamespaces for that.
+&$namespaces: Array of namespaces indexed by their numbers
+
 'LanguageGetMagic': DEPRECATED, use $magicWords in a file listed in 
 $wgExtensionMessagesFiles instead. 
 Use this to define synonyms of magic words depending of the language
@@ -1132,6 +1189,20 @@ $cache: The LocalisationCache object
 $code: language code
 &$alldata: The localisation data from core and extensions
 
+'LogEventsListShowLogExtract': called before the string is added to OutputPage. Returning false will prevent the string from being added to the OutputPage
+&$s: html string to show for the log extract
+$types: String or Array Log types to show
+$page: String or Title The page title to show log entries for
+$user: String The user who made the log entries
+$param: Associative Array with the following additional options:
+ - lim Integer Limit of items to show, default is 50
+ - conds Array Extra conditions for the query (e.g. "log_action != 'revision'")
+ - showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty if set to true (default), "No matching items in log" is displayed if loglist is empty
+ - msgKey Array If you want a nice box with a message, set this to the key of the message. First element is the message key, additional optional elements are parameters for the key that are processed with wgMsgExt and option 'parse'
+ - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset
+ - wrap String Wrap the message in html (usually something like "<div ...>$1</div>").
+ - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS)
+
 'LoginAuthenticateAudit': a login attempt for a valid user account either
 succeeded or failed. No return data is accepted; this hook is for auditing only.
 $user: the User object being authenticated against
@@ -1170,6 +1241,8 @@ depend on the current page/request; static configuration should be added
 through ResourceLoaderGetConfigVars instead.
 &$vars: variable (or multiple variables) to be added into the output
        of Skin::makeVariablesScript
+&$out: The OutputPage which called the hook,
+    can be used to get the real title
 
 'MarkPatrolled': before an edit is marked patrolled
 $rcid: ID of the revision to be marked patrolled
@@ -1289,6 +1362,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
 
@@ -1370,7 +1449,7 @@ 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.
-$this: the calling Parser instance
+$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
@@ -1386,7 +1465,6 @@ to ensure that tests continue to run properly.
 
 'PersonalUrls': Alter the user-specific navigation links (e.g. "my page,
 my talk page, my contributions" etc).
-
 &$personal_urls: Array of link specifiers (see SkinTemplate.php)
 &$title: Title object representing the current page
 
@@ -1426,15 +1504,6 @@ $errorMsg: an html message string of an error
 $article: the page the form is shown for
 $out: OutputPage object
 
-'ResourceLoaderRegisterModules': Right before modules information is required, such as when responding to a resource
-loader request or generating HTML output.
-&$resourceLoader: ResourceLoader object
-
-'ResourceLoaderGetStartupModules': Run once the startup module is being generated. This allows you
-to add modules to the startup module. This hook should be used sparingly since any module added here
-will be loaded on all pages. This hook is useful if you want to make code available to module loader 
-scripts. 
-
 'RawPageViewBeforeOutput': Right before the text is blown out in action=raw
 &$obj: RawPage object
 &$text: The text that's going to be the output
@@ -1448,6 +1517,15 @@ configuration variables to JavaScript. Things that depend on the current
 page/request state must be added through MakeGlobalVariablesScript instead.
 &$vars: array( variable name => value )
 
+'ResourceLoaderGetStartupModules': Run once the startup module is being generated. This allows you
+to add modules to the startup module. This hook should be used sparingly since any module added here
+will be loaded on all pages. This hook is useful if you want to make code available to module loader 
+scripts. 
+
+'ResourceLoaderRegisterModules': Right before modules information is required, such as when responding to a resource
+loader request or generating HTML output.
+&$resourceLoader: ResourceLoader object
+
 'RevisionInsertComplete': called after a revision is inserted into the DB
 &$revision: the Revision
 $data: the data stored in old_text.  The meaning depends on $flags: if external
@@ -1588,6 +1666,10 @@ $checkEdit: Whether or not the action=edit query should be added if appropriate.
 'SkinTemplateToolboxEnd': Called by SkinTemplate skins after toolbox links have
 been rendered (useful for adding more)
 $sk: The QuickTemplate based skin template running the hook.
+$dummy: Called when SkinTemplateToolboxEnd is used from a BaseTemplate skin,
+  extensions that add support for BaseTemplateToolbox should watch for this dummy
+  parameter with "$dummy=false" in their code and return without echoing any html
+  to avoid creating duplicate toolbox items.
 
 'SoftwareInfo': Called by Special:Version for returning information about
 the software
@@ -1678,6 +1760,11 @@ $opts: FormOptions for this request
 &$query_options: array of options for the database request
 &$select: Array of columns to select
 
+'SpecialSearchCreateLink': called when making the message to create a page or
+go to the existing page
+$t: title object searched for
+&$params: an array of the default message name and page title (as parameter)
+
 'SpecialSearchGo': called when user clicked the "Go"
 &$title: title object generated from the text entered by the user
 &$term: the search term entered by the user
@@ -1686,6 +1773,12 @@ $opts: FormOptions for this request
 target doesn't exist
 &$title: title object generated from the text entered by the user
 
+'SpecialSearchPowerBox': the equivalent of SpecialSearchProfileForm for
+the advanced form, a.k.a. power search box
+&$showSections: an array to add values with more options to
+$term: the search term (not a title object)
+$opts: an array of hidden options (containing 'redirs' and 'profile')
+
 'SpecialSearchProfiles': allows modification of search profiles
 &$profiles: profiles, which can be modified.
 
@@ -1734,6 +1827,11 @@ Each key maps to an associative array with a 'msg' (message key) and a 'default'
 &$join_conds: join conditions for the tables
 &$fields: array of query fields
 
+'TestCanonicalRedirect': called when about to force a redirect to a canonical URL for a title when we have no other parameters on the URL. Gives a chance for extensions that alter page view behavior radically to abort that redirect or handle it manually.
+$request: WebRequest
+$title: Title of the currently found title obj
+$output: OutputPage object
+
 'TitleArrayFromResult': called when creating an TitleArray object from a
 database result
 &$titleArray: set this to an object to override the default object returned
@@ -1744,6 +1842,20 @@ $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()
+
+'TitleIsMovable': Called when determining if it is possible to move a page.
+Note that this hook is not called for interwiki pages or pages in immovable namespaces: for these, isMovable() always returns false.
+$title: Title object that is being checked
+$result: Boolean; whether MediaWiki currently thinks this page is movable. Hooks may change this value to override the return value of Title::isMovable()
+
+'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
@@ -1903,6 +2015,10 @@ $user: User to get groups for
 'UserGetAllRights': after calculating a list of all available rights
 &$rights: Array of rights, which may be added to.
 
+'UserGetDefaultOptions': after fetching the core default, this hook is ran
+right before returning the options to the caller.
+&$defaultOptions: Array of preference keys and their default values. 
+
 'UserGetEmail': called when getting an user email address
 $user: User object
 &$email: email, change this to override local email
@@ -2035,6 +2151,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.
@@ -2042,6 +2167,13 @@ One, and only one hook should set this, and return false.
 &$opts: Options to use for the query
 &$join: Join conditions
 
+'wfShellMaintenanceCmd': Called when generating a shell-escaped command line
+       string to run a maintenance script.
+&$script: MediaWiki maintenance script path
+&$parameters: Array of arguments and options to the script
+&$options: Associative array of options, may contain the 'php' and 'wrapper'
+       keys
+
 'wgQueryPages': called when initialising $wgQueryPages, use this to add new
 query pages to be updated with maintenance/updateSpecialPages.php
 $query: $wgQueryPages itself