Revert r101488, breaks parser test. Add a comment explaining why there is no caching...
[lhc/web/wiklou.git] / docs / hooks.txt
index 44a01b5..506145a 100644 (file)
@@ -518,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
@@ -539,7 +540,8 @@ $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
@@ -596,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
@@ -849,7 +852,7 @@ $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
+'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
@@ -898,6 +901,7 @@ $out: OutputPage object
 $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
@@ -907,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
@@ -930,13 +936,13 @@ $linkcolour_ids: array of prefixed DB keys of the pages linked to,
 $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()
+$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 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.
@@ -1171,18 +1177,36 @@ completed
 &updater: A DatabaseUpdater subclass
 
 'LocalFile::getHistory': called before file history query performed
-$file: the file
+$file: the File object
 $tables: tables
 $fields: select fields
 $conds: conditions
 $opts: query options
 $join_conds: JOIN conditions
 
+'LocalFilePurgeThumbnails': called before thumbnails for a local file a purged
+$file: the File object
+$type: either "current" or "archive"
+
 'LocalisationCacheRecache': Called when loading the localisation data into cache
 $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
@@ -1445,7 +1469,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
 
@@ -1456,6 +1479,18 @@ $action : Action being performed
 Change $result and return false to give a definitive answer, otherwise
 the built-in rate limiting checks are used, if enabled.
 
+'PlaceNewSection': Override placement of new sections.
+$wikipage : WikiPage object
+$oldtext : the text of the article before editing
+$subject : subject of the new section
+&$text : text of the new section
+Return false and put the merged text into $text to override the default behavior.
+
+'PreferencesGetLegend': Override the text used for the <legend> of a preferences section
+$form: the PreferencesForm object. This is a ContextSource as well
+$key: the section name
+&$legend: the legend text. Defaults to wfMsg( "prefs-$key" ) but may be overridden
+
 'PrefixSearchBackend': Override the title prefix search used for OpenSearch and
 AJAX search suggestions. Put results into &$results outparam and return false.
 $ns : array of int namespace keys to search in
@@ -1479,21 +1514,12 @@ $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
+$errorMsg: an html message string of an error or an array of message name and its parameters
 
 'ProtectionForm::showLogExtract': called after the protection log extract is shown
 $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
@@ -1507,6 +1533,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
@@ -1647,6 +1682,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
@@ -1737,6 +1776,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
@@ -1745,6 +1789,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.
 
@@ -1793,6 +1843,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
@@ -1976,6 +2031,13 @@ $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. WARNING: this hook is
+called for every call to User::getDefaultOptions(), which means it's
+potentially called dozens or hundreds of times. You may want to cache
+the results of non-trivial operations in your hook function for this reason.
+&$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
@@ -2124,6 +2186,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