Made UnwatchArticle, UnwatchArticleComplete, WatchArticle and WatchArticleComplete...
[lhc/web/wiklou.git] / docs / hooks.txt
index 3652c3a..8302d2e 100644 (file)
@@ -319,12 +319,16 @@ $text : the new text of the article (has yet to be saved)
 &$resultArr : data in this array will be added to the API result
 
 'APIGetAllowedParams': use this hook to modify a module's parameters.
-&$module: Module object
+&$module: ApiBase Module object
 &$params: Array of parameters
 
+'APIGetDescription': use this hook to modify a module's description
+&$module: ApiBase Module object
+&$desc: Array of descriptions
+
 'APIGetParamDescription': use this hook to modify a module's parameter
 descriptions.
-&$module: Module object
+&$module: ApiBase Module object
 &$desc: Array of parameter descriptions
 
 'APIQueryAfterExecute': after calling the execute() method of an
@@ -387,7 +391,7 @@ $tokenFunctions: array(action => callback)
 'ApiRsdServiceApis': Add or remove APIs from the RSD services list.
 Each service should have its own entry in the $apis array and have a
 unique name, passed as key for the array that represents the service data.
-In this data array, the key-value-pair identified by the apiLink key is 
+In this data array, the key-value-pair identified by the apiLink key is
 required.
 &$apis: array of services
 
@@ -583,9 +587,9 @@ $name: Image name being checked
 Change $bad and return false to override. If an image is "bad", it is not
 rendered inline in wiki pages or galleries in category pages.
 
-'BeforeInitialize': before anything is initialized in performRequestForTitle()
+'BeforeInitialize': before anything is initialized in MediaWiki::performRequest()
 &$title: Title being used for request
-&$article: The associated Article object
+$unused: null
 &$output: OutputPage object
 &$user: User
 $request: WebRequest object
@@ -595,6 +599,13 @@ $mediaWiki: Mediawiki object
 &$out: OutputPage object
 &$skin: Skin object
 
+'BeforePageRedirect': Prior to sending an HTTP redirect. Gives a chance to
+override how the redirect is output by modifying, or by returning false and
+taking over the output.
+$out: OutputPage object
+&$redirect: URL, modifiable
+&$code: HTTP code (eg '301' or '302'), modifiable
+
 'BeforeParserFetchFileAndTitle': before an image is rendered by Parser
 $parser: Parser object
 $nt: the image title
@@ -613,15 +624,15 @@ $title: title of the template
 &$parser: Parser object
 &$ig: ImageGallery object
 
-'BeforeWelcomeCreation': before the welcomecreation message is displayed to a newly created user 
+'BeforeWelcomeCreation': before the welcomecreation message is displayed to a newly created user
 &$welcome_creation_msg: MediaWiki message name to display on the welcome screen to a newly created user account
-&$injected_html: Any HTML to inject after the "logged in" message of a newly created user account 
+&$injected_html: Any HTML to inject after the "logged in" message of a newly created user account
 
-'BitmapHandlerTransform': before a file is transformed, gives extension the 
+'BitmapHandlerTransform': before a file is transformed, gives extension the
 possibility to transform it themselves
-$handler: BitmapHandler 
+$handler: BitmapHandler
 $image: File
-&$scalerParams: Array with scaler parameters 
+&$scalerParams: Array with scaler parameters
 &$mto: null, set to a MediaTransformOutput
 
 'BitmapHandlerCheckImageArea': by BitmapHandler::normaliseParams, after all normalizations have been performed, except for the $wgMaxImageArea check
@@ -647,7 +658,7 @@ $output: OutputPage object in use
 
 'CanonicalNamespaces': For extensions adding their own namespaces or altering the defaults
 &$namespaces: Array of namespace numbers with corresponding canonical names
+
 'CategoryPageView': before viewing a categorypage in CategoryPage::view
 $catpage: CategoryPage instance
 
@@ -753,7 +764,7 @@ $editpage_Obj: the current EditPage object
 
 'EditPage::importFormData': allow extensions to read additional data
 posted in the form
-$editpage: EditPage instance 
+$editpage: EditPage instance
 $request: Webrequest
 return value is ignored (should always return true)
 
@@ -863,6 +874,10 @@ $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
 
+'ExtractThumbParameters': called when extracting thumbnail parameters from a thumbnail file name
+$thumbname: the base name of the thumbnail file
+&$params: the currently extracted params (has source name, temp or archived zone)
+
 'FetchChangesList': When fetching the ChangesList derivative for
 a particular user
 $user: User the list is being fetched for
@@ -906,7 +921,6 @@ $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
@@ -916,13 +930,11 @@ $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
@@ -941,13 +953,11 @@ $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 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.
@@ -959,7 +969,7 @@ $title: Title object of page
        that need to have versioned metadata should add an element to the end of
        the version array of the form 'handler_name=version'. Most media handlers
        won't need to do this unless they broke backwards compatibility with a
-       previous version of the media handler metadata output. 
+       previous version of the media handler metadata output.
 &$version: Array of version strings
 
 'GetPreferences': modify user preferences
@@ -1000,7 +1010,7 @@ $result: User permissions error to add. If none, return true.
 $imagePage: ImagePage object ($this)
 $output: $wgOut
 
-'ImagePageAfterImageLinks': called after the image links section on an image 
+'ImagePageAfterImageLinks': called after the image links section on an image
        page is built
 $imagePage: ImagePage object ($this)
 &$html: HTML for the hook to add
@@ -1066,7 +1076,7 @@ $article: Article object
 'InterwikiLoadPrefix': When resolving if a given prefix is an interwiki or not.
 Return true without providing an interwiki to continue interwiki search.
 $prefix: interwiki prefix we are looking for.
-&$iwData: output array describing the interwiki with keys iw_url, iw_local, 
+&$iwData: output array describing the interwiki with keys iw_url, iw_local,
   iw_trans and optionally iw_api and iw_wikiid.
 
 'InternalParseBeforeLinks': during Parser's internalParse method before links
@@ -1100,13 +1110,17 @@ $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
 
+'Language::getMessagesFileName':
+$code: The language code or the language we're looking for a messages file for
+&$file: The messages file path, you can override this to change the location.
+
 'LanguageGetNamespaces': Provide custom ordering for namespaces or
-remove namespaces. Do not use this hook to add namespaces. Use 
+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. 
+'LanguageGetMagic': DEPRECATED, use $magicWords in a file listed in
+$wgExtensionMessagesFiles instead.
 Use this to define synonyms of magic words depending of the language
 $magicExtensions: associative array of magic words synonyms
 $lang: laguage code (string)
@@ -1207,11 +1221,22 @@ $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'
+ - 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 wfMsgExt 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)
 
+'LoggableUserIPData': called when IP data for a user action can be logged by extensions like CheckUser.
+This is intended for when users do things that do not already create edits or log entries.
+$context: The context the of the action, which includes the user and request
+$data: Associative array of data for handlers to record. It must include values for:
+ - 'namespace' Integer namespace for target title (NS_SPECIAL is allowed)
+ - 'title'     Database key string for target title (empty string if not applicable)
+ - 'pageid'    Integer page ID for target title (zero if not applicable)
+ - 'action'    Wikitext string in the same format as an edit summary
+ - 'comment'   Wikitext string in the same format as an edit summary
+ - 'timestamp' Timestamp when the action occured
+
 'LoginAuthenticateAudit': a login attempt either succeeded or
 failed. This may be called before the User object is populated, so a
 user object equivalent to an anonymous user. No return data is
@@ -1239,7 +1264,7 @@ $time: timestamp of the log entry (added in 1.12)
 $refreshLinks: RefreshLinks object
 
 'MagicWordMagicWords': When defining new magic word.
-DEPRECATED: use $magicWords in a file listed in 
+DEPRECATED: use $magicWords in a file listed in
 $wgExtensionMessagesFiles instead.
 $magicWords: array of strings
 
@@ -1296,8 +1321,8 @@ $db: The database object to be queried.
 'MonoBookTemplateToolboxEnd': Called by Monobook skin after toolbox links have
 been rendered (useful for adding more)
 Note: this is only run for the Monobook skin. This hook is deprecated and
-may be removed in the future. To add items to the toolbox you should use 
-the SkinTemplateToolboxEnd hook instead, which works for all 
+may be removed in the future. To add items to the toolbox you should use
+the SkinTemplateToolboxEnd hook instead, which works for all
 "SkinTemplate"-type skins.
 $tools: array of tools
 
@@ -1534,6 +1559,11 @@ $out: OutputPage object
 'RecentChange_save': called at the end of RecentChange::save()
 $recentChange: RecentChange object
 
+'RequestContextCreateSkin': Called when RequestContext::getSkin creates a skin instance.
+Can be used by an extension override what skin is used in certain contexts.
+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.
+
 'ResourceLoaderGetConfigVars': called at the end of
 ResourceLoaderStartUpModule::getConfig(). Use this to export static
 configuration variables to JavaScript. Things that depend on the current
@@ -1542,13 +1572,23 @@ page/request state must be added through MakeGlobalVariablesScript instead.
 
 '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. 
+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
 
+'ResourceLoaderTestModules': let you add new JavaScript testing modules. This is called after the addition of 'qunit' and MediaWiki testing resources.
+&testModules: array of JavaScript testing modules. The 'qunit' framework, included in core, is fed using tests/qunit/QUnitTestResources.php.
+&ResourceLoader object
+To add a new qunit module named 'myext.tests':
+testModules['qunit']['myext.tests'] = array(
+       'script' => 'extension/myext/tests.js',
+       'dependencies' => <any module dependency you might have>
+);
+For qunit framework, the mediawiki.tests.qunit.testrunner dependency will be added to any module.
+
 '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
@@ -1577,7 +1617,7 @@ $term : Search term string
 &$title : Current Title object that is being returned (null if none found).
 
 'SearchEngineReplacePrefixesComplete': Run after SearchEngine::replacePrefixes().
-$searchEngine : The SearchEngine object. Users of this hooks will be interested 
+$searchEngine : The SearchEngine object. Users of this hooks will be interested
 in the $searchEngine->namespaces array.
 $query : Original query.
 &$parsed : Resultant query with the prefixes stripped.
@@ -1635,7 +1675,7 @@ $title: displayed page title
 $type: 'normal' or 'history' for old/diff views
 &$msg: overridable message; usually 'copyright' or 'history_copyright'. This message must be in HTML format, not wikitext!
 &$link: overridable HTML link to be passed into the message as $1
-&$forContent: overridable flag if copyright footer is shown in content language. 
+&$forContent: overridable flag if copyright footer is shown in content language.
 
 'SkinGetPoweredBy'
 &$text: additional 'powered by' icons in HTML.
@@ -1758,9 +1798,9 @@ $data: array of data submitted by the user
 'SpecialRandomGetRandomTitle': called during the execution of Special:Random,
 use this to change some selection criteria or substitute a different title
 &$randstr: The random number from wfRandom()
-&$isRedir: Boolean, whether to select a redirect or non-redirect 
+&$isRedir: Boolean, whether to select a redirect or non-redirect
 &$namespaces: An array of namespace indexes to get the title from
-&$extra: An array of extra SQL statements 
+&$extra: An array of extra SQL statements
 &$title: If the hook returns false, a Title object to use instead of the
 result from the normal query
 
@@ -1828,10 +1868,10 @@ no matches
 $term: string of search term
 
 'SpecialStatsAddExtra': add extra statistic at the end of Special:Statistics
-&$extraStats: Array to save the new stats 
+&$extraStats: Array to save the new stats
               ( $extraStats['<name of statistic>'] => <value>; )
 
-'SpecialUploadComplete': Called after successfully uploading a file from 
+'SpecialUploadComplete': Called after successfully uploading a file from
 Special:Upload
 $form: The SpecialUpload object
 
@@ -1886,6 +1926,13 @@ $user: user who did the move
 $pageid: database ID of the page that's been moved
 $redirid: database ID of the created redirect
 
+'TitleReadWhitelist': called at the end of read permissions checks, just before
+       adding the default error message if nothing allows the user to read the page.
+       If a handler wants a title to *not* be whitelisted, it should also return false.
+$title: Title object being checked against
+$user: Current user object
+&$whitelisted: Boolean value of whether this title is whitelisted
+
 'UndeleteForm::showHistory': called in UndeleteForm::showHistory, after a
 PageArchive object has been created but before any further processing is done.
 &$archive: PageArchive object
@@ -1917,15 +1964,11 @@ $article: article "acted on"
 
 'UnwatchArticle': before a watch is removed from an article
 $user: user watching
-$article: article object to be removed
-
-'UnwatchArticle': after a watch is removed from an article
-$user: user that was watching
-$article: article object removed
+$page: WikiPage object to be removed
 
 'UnwatchArticleComplete': after a watch is removed from an article
 $user: user that watched
-$article: article object that was watched
+$page: WikiPage object that was watched
 
 'UploadForm:initial': before the upload form is generated
 $form: UploadForm object
@@ -1938,7 +1981,7 @@ $form: UploadForm object
 Lets you poke at member variables like $mUploadDescription before the
 file is saved.
 Do not use this hook to break upload processing. This will return the user to
-a blank form with no error message; use UploadVerification and 
+a blank form with no error message; use UploadVerification and
 UploadVerifyFile instead
 
 'UploadCreateFromRequest': when UploadBase::createFromRequest has been called
@@ -1948,19 +1991,19 @@ $type: (string) the requested upload type
 'UploadComplete': when Upload completes an upload
 &$upload: an UploadBase child instance
 
-'UploadFormInitDescriptor': after the descriptor for the upload form as been 
+'UploadFormInitDescriptor': after the descriptor for the upload form as been
        assembled
 $descriptor: (array) the HTMLForm descriptor
 
-'UploadFormSourceDescriptors': after the standard source inputs have been 
+'UploadFormSourceDescriptors': after the standard source inputs have been
 added to the descriptor
 $descriptor: (array) the HTMLForm descriptor
 
-'UploadVerification': additional chances to reject an uploaded file. Consider 
+'UploadVerification': additional chances to reject an uploaded file. Consider
                       using UploadVerifyFile instead.
 string $saveName: destination file name
 string $tempName: filesystem path to the temporary file for checks
-string &$error: output: message key for message to show if upload canceled 
+string &$error: output: message key for message to show if upload canceled
        by returning false. May also be an array, where the first element
        is the message key and the remaining elements are used as parameters to
        the message.
@@ -1968,7 +2011,7 @@ string &$error: output: message key for message to show if upload canceled
 'UploadVerifyFile': extra file verification, based on mime type, etc. Preferred
                     in most cases over UploadVerification.
 object $upload: an instance of UploadBase, with all info about the upload
-string $mime: the uploaded file's mime type, as detected by MediaWiki. Handlers 
+string $mime: the uploaded file's mime type, as detected by MediaWiki. Handlers
        will typically only apply for specific mime types.
 object &$error: output: true if the file is valid. Otherwise, an indexed array
        representing the problem with the file, where the first element
@@ -2047,7 +2090,7 @@ 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. 
+&$defaultOptions: Array of preference keys and their default values.
 
 'UserGetEmail': called when getting an user email address
 $user: User object
@@ -2161,6 +2204,11 @@ $user: User object
 &$timestamp: new timestamp, change this to override local email
 authentification timestamp
 
+'UserToolLinksEdit': Called when generating a list of user tool links, eg "Foobar (Talk | Contribs | Block)"
+$userId: User id of the current user
+$userText: User name of the current user
+&$items: Array of user tool links as HTML fragments
+
 'WantedPages::getQueryInfo': called in WantedPagesPage::getQueryInfo(), can be
 used to alter the SQL query which gets the list of wanted pages
 &$wantedPages: WantedPagesPage object
@@ -2168,11 +2216,11 @@ 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
-$article: article object to be watched
+$page: WikiPage object to be watched
 
 'WatchArticleComplete': after a watch is added to an article
 $user: user that watched
-$article: article object watched
+$page: WikiPage object watched
 
 'WatchlistEditorBuildRemoveLine': when building remove lines in
        Special:Watchlist/edit
@@ -2181,14 +2229,8 @@ $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.
+'WebRequestPathInfoRouter': While building the PathRouter to parse the REQUEST_URI.
+$router: The PathRouter instance
 
 'WikiExporter::dumpStableQuery': Get the SELECT query for "stable" revisions
 dumps