X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=docs%2Fhooks.txt;h=00c5f5a2aa3f48c8831f894dbc0cddabfdd12175;hb=5f519113382b8695855be7e303f159a2abeb4253;hp=927c82719506a643362f269994e90883edc087b9;hpb=8e22becd1bec0a46cc44ffbf37977f6e71801bd0;p=lhc%2Fweb%2Fwiklou.git diff --git a/docs/hooks.txt b/docs/hooks.txt index 927c827195..00c5f5a2aa 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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 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 @@ -295,6 +324,17 @@ associated Revision object. In the hook, just add your callback to the $tokenFunctions array and return true (returning false makes no sense) $tokenFunctions: array(action => callback) +'APIQueryRecentChangesTokens': use this hook to add custom tokens to list=recentchanges. +Every token has an action, which will be used in the rctoken parameter +and in the output (actiontoken="..."), and a callback function which +should return the token, or false if the user isn't allowed to obtain +it. The prototype of the callback function is func($pageid, $title, $rc) +where $pageid is the page ID of the page associated to the revision the +token is requested for, $title the associated Title object and $rc the +associated RecentChange object. In the hook, just add your callback to the +$tokenFunctions array and return true (returning false makes no sense) +$tokenFunctions: array(action => callback) + 'ArticleAfterFetchContent': after fetching content of an article from the database $article: the article (object) being loaded from the database $content: the content (string) of the article @@ -315,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 @@ -672,6 +717,9 @@ $result: User permissions error to add. If none, return true. 'getUserPermissionsErrorsExpensive': Absolutely the same, but is called only if expensive checks are enabled. +'HTMLCacheUpdate::doUpdate': After cache invalidation updates are inserted into the job queue. +$title: Title object, pages linked to this title are purged. + 'ImageBeforeProduceHTML': Called before producing the HTML created by a wiki image insertion. You can skip the default logic entirely by returning false, or just modify a few things using call-by-reference. @@ -755,7 +803,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(), @@ -883,6 +931,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 @@ -892,6 +941,11 @@ $baseID: the revision ID this was based off, if any whether to use the content language (true) or site language (false) (bool) &$transform: whether or not to expand variables and templates in the message (bool) +'OldChangesListRecentChangesLine': Customize entire Recent Changes line. +&$changeslist: The OldChangesList instance. +&$s: HTML of the form "
  • ...
  • " containing one RC entry. +&$rc: The RecentChange object. + 'OpenSearchUrls': Called when constructing the OpenSearch description XML. Hooks can alter or append to the array of URLs for search & suggestion formats. &$urls: array of associative arrays with Url element attributes @@ -901,6 +955,9 @@ the resulting HTML is about to be displayed. $parserOutput: the parserOutput (object) that corresponds to the page $text: the text that will be displayed, in HTML (string) +'OutputPageCheckLastModified': when checking if the page has been modified since the last visit +&$modifiedTimes: array of timestamps, the following keys are set: page, user, epoch + 'OutputPageParserOutput': after adding a parserOutput to $wgOut $out: OutputPage instance (object) $parserOutput: parserOutput instance being added in $out @@ -1064,11 +1121,6 @@ $text: Text being shown $title: Title of the custom script/stylesheet page $output: Current OutputPage object -'SiteFromDB': Customise the conversion of a database name to site information in SiteConfiguration -$db: The DB name being converted. -&$site: The site type (out). -&$lang: The "language" (subdomain) - 'SiteNoticeBefore': Before the sitenotice/anonnotice is composed &$siteNotice: HTML returned as the sitenotice Return true to allow the normal method of notice selection/rendering to work, @@ -1154,6 +1206,10 @@ $query: The query array to be returned $item: HTML to be returned. Will be wrapped in
  • after the hook finishes $row: Database row object +'SpecialListusersGetGroups': called right before the end of UsersPager::getGroups() +&$groups: array of groups the user is in +$uid: User identifier + 'SpecialListusersHeader': called before closing the
    in UsersPager::getPageHeader() $pager: The UsersPager instance $out: The header HTML @@ -1171,24 +1227,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 @@ -1324,10 +1362,13 @@ $user: User to get rights for $user: user object $name: user name -'UserLoadFromSession': called to authenticate users on external/environmental means +'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. @@ -1359,7 +1400,6 @@ $addergroups : Array of groups that the user is in 'add-self' => array( addablegroups to self ), 'remove-self' => array( removable groups from self ) ) - 'UserRetrieveNewTalks': called when retrieving "You have new messages!" message(s) $user: user retrieving new talks messages $talks: array of new talks page(s)