Added new hook 'MessageCacheReplace' into MessageCache.php. For instance
[lhc/web/wiklou.git] / docs / hooks.txt
index d26d514..9cfaa39 100644 (file)
@@ -198,6 +198,10 @@ system (LDAP, another PHP program, whatever), you could do:
 Returning false makes less sense for events where the action is complete, and
 will normally be ignored.
 
+Note that none of the examples made use of create_function() as a way to
+attach a function to a hook. This is known to cause problems (notably with 
+Special:Version), and should be avoided when at all possible.
+
 ==Using hooks==
 
 A calling function or method uses the wfRunHooks() function to run the hooks
@@ -234,6 +238,9 @@ to add events to the MediaWiki code.
 $autoblockip: The IP going to be autoblocked.
 $block: The block from which the autoblock is coming.
 
+'AbortDiffCache': Can be used to cancel the caching of a diff
+&$diffEngine: DifferenceEngine object
+
 'AbortLogin': Return false to cancel account login.
 $user: the User object being authenticated against
 $password: the password being submitted, not yet checked for validity
@@ -265,6 +272,10 @@ before showing the edit form ( EditPage::edit() ). This is triggered
 on &action=edit.
 $EditPage : the EditPage object
 
+'APIAfterExecute': after calling the execute() method of an API module.
+Use this to extend core API modules.
+&$module: Module object
+
 'APIEditBeforeSave': before saving a page with api.php?action=edit,
 after processing request parameters. Return false to let the request
 fail, returning an error message or an <edit result="Failure"> tag
@@ -273,6 +284,24 @@ $EditPage : the EditPage object
 $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
+&$params: Array of parameters
+
+'APIGetParamDescription': use this hook to modify a module's parameter
+descriptions.
+&$module: Module object
+&$desc: Array of parameter descriptions
+
+'APIQueryAfterExecute': after calling the execute() method of an
+action=query submodule. Use this to extend core API modules.
+&$module: Module object
+
+'APIQueryGeneratorAfterExecute': after calling the executeGenerator()
+method of an action=query submodule. Use this to extend core API modules.
+&$module: Module object
+&$resultPageSet: ApiPageSet object
+
 'APIQueryInfoTokens': use this hook to add custom tokens to prop=info.
 Every token has an action, which will be used in the intoken parameter
 and in the output (actiontoken="..."), and a callback function which
@@ -326,6 +355,11 @@ $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
 
+'ArticleEditUpdates': when edit updates (mainly link tracking) are made when an article has been changed
+$article: the article (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
 
@@ -386,6 +420,7 @@ $oldPageID: the page ID of the revision when archived (may be null)
 $article: the article 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
@@ -406,6 +441,7 @@ $isWatch: (No longer used)
 $section: (No longer used)
 $flags: Flags passed to Article::doEdit()
 $revision: New Revision of the article
+$baseRevId: the rev ID (or false) this edit was based on
 
 'ArticleUndelete': When one or more revisions of an article are restored
 $title: Title corresponding to the article restored
@@ -471,13 +507,6 @@ rendered inline in wiki pages or galleries in category pages.
 &$parser: Parser object
 &$ig: ImageGallery object
 
-'BeforeWatchlist': Override watchlist display or add extra SQL clauses.
-$nondefaults: Assoc array with the following keys:
-              days, hideOwn, hideBots, hideMinor, namespace
-$wgUser: wgUser.
-&$hookSql: a string which will be inserted without sanitation into the SQL query
-           used to get the watchlist, at the end of the WHERE part.
-
 '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)
@@ -523,6 +552,13 @@ Return true to allow the normal editor to be used, or false
 if implementing a custom editor, e.g. for a special namespace,
 etc.
 
+'NewDifferenceEngine': Called when a new DifferenceEngine object is made
+$title: the diff page title (nullable)
+&$oldId: the actual old Id to use in the diff
+&$newId: the actual new Id to use in the diff (0 means current)
+$old: the ?old= param value from the url
+$new: the ?new= param value from the url
+
 'DiffViewHeader': called before diff display
 $diff: DifferenceEngine object that's calling
 $oldRev: Revision object of the "old" revision (may be null/invalid)
@@ -588,6 +624,12 @@ sections.
 'EditPageBeforeEditButtons':  allows modifying the edit buttons below the textarea in the edit form
 &$editpage: The current EditPage object
 &$buttons: Array of edit buttons "Save", "Preview", "Live", and "Diff"
+&$tabindex: HTML tabindex of the last edit check/button
+
+'EditPageBeforeEditChecks':  allows modifying the edit checks below the textarea in the edit form
+&$editpage: The current EditPage object
+&$checks: Array of edit checks like "watch this page"/"minor edit"
+&$tabindex: HTML tabindex of the last edit check/button
 
 'EditSectionLink': Do not use, use DoEditSectionLink instead.
 $skin: Skin rendering the UI
@@ -720,6 +762,7 @@ $title: Title object ($wgTitle)
 $request: WebRequest
 $ignoreRedirect: boolean to skip redirect check
 $target: Title/string of redirect target
+$article: Article object
 
 'InitPreferencesForm': called at the end of PreferencesForm's constructor
 $form: the PreferencesForm
@@ -769,7 +812,7 @@ $target: the Title that the link is pointing to
        fault values, with a value of false meaning to suppress the attribute.
 &$query: the query string to add to the generated URL (the bit after the "?"),
        in associative array form, with keys and values unescaped.
-&$options: the options.  Can include 'known', 'broken', 'noclasses'.
+&$options: array of options.  Can include 'known', 'broken', 'noclasses'.
 &$ret: the value to return if your hook returns false.
 
 'LinkEnd': Used when generating internal and interwiki links in Linker::link(),
@@ -794,6 +837,8 @@ $options: the options.  Will always include either 'known' or 'broken', and may
 &$url: the link url
 &$text: the link text
 &$link: the new link HTML (if returning false)
+&$attribs: the attributes to be applied.
+$linkType: The external link type
 
 'LinksUpdate': At the beginning of LinksUpdate::doUpdate() just before the actual update
 &$linksUpdate: the LinkUpdate object
@@ -804,6 +849,9 @@ $options: the options.  Will always include either 'known' or 'broken', and may
 'LinksUpdateConstructed': At the end of LinksUpdate() is contruction.
 &$linksUpdate: the LinkUpdate object
 
+'ListDefinedTags': When trying to find all defined tags.
+&$tags: The list of tags.
+
 'LoadAllMessages': called by MessageCache::loadAllMessages() to load extensions messages
 
 'LoadExtensionSchemaUpdates': called by maintenance/updaters.inc when upgrading database schema
@@ -849,7 +897,7 @@ $time: timestamp of the log entry (added in 1.12)
 'MagicWordMagicWords': When defining new magic word. DEPRECATED: Use LanguageGetMagic hook instead
 $magicWords: array of strings
 
-'MagicWordwgVariableIDs': When definig new magic words IDs. DEPRECATED: Use LanguageGetMagic hook instead
+'MagicWordwgVariableIDs': When definig new magic words IDs.
 $variableIDs: array of strings
 
 'MakeGlobalVariablesScript': called right before Skin::makeVariablesScript is executed   
@@ -887,6 +935,10 @@ $this:    The $mediawiki object
 $title: title of the message (string)
 $message: value (string), change it to the message you want to define
 
+'MessageCacheReplace': When a message page is changed. Useful for updating caches.
+$title: name of the page changed.
+$text: new contents of the page.
+
 'MonoBookTemplateToolboxEnd': Called by Monobook skin after toolbox links have been rendered (useful for adding more)
 Note: this is only run for the Monobook skin.  To add items to the toolbox
 for all 'SkinTemplate'-type skins, use the SkinTemplateToolboxEnd hook
@@ -897,6 +949,7 @@ $tools: array of tools
 $article: the article edited
 $rev: the new revision
 $baseID: the revision ID this was based off, if any
+$user: the editing user
 
 'NormalizeMessageKey': Called before the software gets the text of a message
   (stuff in the MediaWiki: namespace), useful for changing WHAT message gets displayed
@@ -1081,6 +1134,8 @@ $text : Current text being indexed
 $term : Search term string
 &$title : Outparam; set to $title object and return false for a match
 
+'SetupAfterCache': Called in Setup.php, after cache objects are set
+
 'ShowRawCssJs': Customise the output of raw CSS and JavaScript in page views
 $text: Text being shown
 $title: Title of the custom script/stylesheet page
@@ -1188,24 +1243,6 @@ $movePage: MovePageForm object
 $oldTitle: old title (object)
 $newTitle: new title (object)
 
-'SpecialPageExecuteAfterPage': called after executing a special page
-Warning: Not all the special pages call this hook
-$specialPage: SpecialPage object
-$par: paramter passed to the special page (string)
-$funct: function called to execute the special page
-
-'SpecialPageExecuteBeforeHeader': called before setting the header text of the special page
-Warning: Not all the special pages call this hook
-$specialPage: SpecialPage object
-$par: paramter passed to the special page (string)
-$funct: function called to execute the special page
-
-'SpecialPageExecuteBeforePage': called after setting the special page header text but before the main execution
-Warning: Not all the special pages call this hook
-$specialPage: SpecialPage object
-$par: paramter passed to the special page (string)
-$funct: function called to execute the special page
-
 'SpecialPage_initList': called when setting up SpecialPage::$mList, use this hook to remove a core special page
 $list: list (array) of core special pages
 
@@ -1214,11 +1251,10 @@ $list: list (array) of core special pages
 $opts: FormOptions for this request
 
 'SpecialRecentChangesQuery': called when building sql query for SpecialRecentChanges
-&$conds: array of where conditionals for query
+&$conds: array of WHERE conditionals for query
 &$tables: array of tables to be queried
 &$join_conds: join conditions for the tables
 $opts: FormOptions for this request
-&$fields: select fields
 
 'SpecialSearchNogomatch': called when user clicked the "Go" button but the target doesn't exist
 $title: title object generated from the text entred by the user
@@ -1234,6 +1270,12 @@ $term: string of search term
 'SpecialVersionExtensionTypes': called when generating the extensions credits, use this to change the tables headers
 $extTypes: associative array of extensions types
 
+'SpecialWatchlistQuery': called when building sql query for SpecialWatchlist
+&$conds: array of WHERE conditionals for query
+&$tables: array of tables to be queried
+&$join_conds: join conditions for the tables
+&$fields: array of query fields
+
 'TitleArrayFromResult': called when creating an TitleArray object from a database result
 &$titleArray: set this to an object to override the default object returned
 $res: database result used to create the object
@@ -1310,9 +1352,21 @@ $user: User (object) whose permission is being checked
 'UserClearNewTalkNotification': called when clearing the "You have new messages!" message, return false to not delete it
 $user: User (object) that'll clear the message
 
+'UserComparePasswords': called when checking passwords, return false to override the default password checks
+&$hash: String of the password hash (from the database)
+&$password: String of the plaintext password the user entered
+&$userId: Integer of the user's ID or Boolean false if the user ID was not supplied
+&$result: If the hook returns false, this Boolean value will be checked to determine if the password was valid
+
 'UserCreateForm': change to manipulate the login form
 $template: SimpleTemplate instance for the form
 
+'UserCryptPassword': called when hashing a password, return false to implement your own hashing method
+&$password: String of the plaintext password to encrypt
+&$salt: String of the password salt or Boolean false if no salt is provided
+&$wgPasswordSalt: Boolean of whether the salt is used in the default hashing method
+&$hash: If the hook returns false, this String will be used as the hash
+
 'UserEffectiveGroups': Called in User::getEffectiveGroups()
 $user: User to get groups for
 &$groups: Current effective groups
@@ -1338,14 +1392,26 @@ $user: User object
 $user: User to get rights for
 &$rights: Current rights
 
+'UserIsBlockedGlobally': Check if user is blocked on all wikis.
+&$user: User object
+$ip: User's IP address
+&$blocked: Whether the user is blocked, to be modified by the hook
+
 'UserLoadDefaults': called when loading a default user
 $user: user object
 $name: user name
 
-'UserLoadFromSession': called to authenticate users on external/environmental means
+'UserLoadFromDatabase': called when loading a user from the database
+$user: user object
+&$s: database query object
+
+'UserLoadFromSession': called to authenticate users on external/environmental means; occurs before session is loaded
 $user: user object being loaded
 &$result: set this to a boolean value to abort the normal authentification process
 
+'UserLoadAfterLoadFromSession': called to authenticate users on external/environmental means; occurs after session is loaded
+$user: user object being loaded
+
 'UserLoginComplete': after a user has logged in
 $user: the user object that was created on login
 $inject_html: Any HTML to inject after the "logged in" message.
@@ -1401,6 +1467,10 @@ $user: User object
 'UserToggles': called when initialising User::$mToggles, use this to add new toggles
 $toggles: array of toggles to add
 
+'WantedPages::getSQL': called in WantedPagesPage::getSQL(), can be used to alter the SQL query which gets the list of wanted pages
+&$wantedPages: WantedPagesPage object
+&$sql: raw SQL query used to get 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