* Unescape two entities when transforming. Motivation is to allow to use "Foo&nbsp...
[lhc/web/wiklou.git] / docs / hooks.txt
index 04b1e2a..b529946 100644 (file)
@@ -335,6 +335,15 @@ 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)
 
+'APIQueryUsersTokens': use this hook to add custom token to list=users.
+Every token has an action, which will be used in the ustoken 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($user) where $user
+is the User 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
@@ -441,6 +450,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
@@ -551,6 +561,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)
@@ -702,6 +719,10 @@ $title: Title object of page
 $url: string value as output (out parameter, can modify)
 $query: query options passed to Title::getLocalURL()
 
+'GetPreferences': modify user preferences
+$user: User whose preferences are being modified.
+&$preferences: Preferences description array, to be fed to an HTMLForm object
+
 'getUserPermissionsErrors': Add a permissions error when permissions errors are
        checked for.  Use instead of userCan for most cases. Return false if the
        user can't do it, and populate $result with the reason in the form of
@@ -756,10 +777,6 @@ $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
-$request: the web request to initialized from
-
 'InternalParseBeforeLinks': during Parser's internalParse method before links but
 after noinclude/includeonly/onlyinclude and other processing.
 &$this: Parser object
@@ -829,6 +846,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
@@ -839,7 +858,11 @@ $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
+&$messageCache: The MessageCache object
 
 'LoadExtensionSchemaUpdates': called by maintenance/updaters.inc when upgrading database schema
 
@@ -884,7 +907,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   
@@ -922,6 +945,17 @@ $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.
+
+'MessageNotInMwNs': When trying to get a message that isn't found in the
+MediaWiki namespace (but before checking the message files)
+&$message: message's content; can be changed
+$lckey: message's name
+$langcode: language code
+$isFullKey: specifies whether $lckey is a two part key "msg/lang"
+
 '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
@@ -1055,10 +1089,6 @@ $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.
 
-'PreferencesUserInformationPanel': Add HTML bits to user information list in preferences form
-$form : PreferencesForm object
-&$html : HTML to append to
-
 '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
@@ -1083,14 +1113,6 @@ $error: error (string) 'badretype', 'wrongpassword', 'error' or 'success'
 'RecentChange_save': called at the end of RecenChange::save()
 $recentChange: RecentChange object
 
-'RenderPreferencesForm': called at the end of PreferencesForm::mainPrefsForm
-$form: the PreferencesForm
-$out: output page to render to, probably $wgOut
-
-'ResetPreferences': called at the end of PreferencesForm::resetPrefs
-$form: the PreferencesForm
-$user: the User object to load preferences from
-
 '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
@@ -1100,13 +1122,6 @@ $data: the data stored in old_text.  The meaning depends on $flags: if external
 $flags: a comma-delimited list of strings representing the options used.  May
   include: utf8 (this will always be set for new revisions); gzip; external.
 
-'SavePreferences': called at the end of PreferencesForm::savePreferences; 
-                   returning false prevents the preferences from being saved.
-$form: the PreferencesForm
-$user: the User object to save preferences to
-$message: change this to set an error message (ignored if the hook does not return false)
-$old: old preferences of the user
-
 'SearchUpdate': Prior to search update completion
 $id : Page id
 $namespace : Page namespace
@@ -1198,6 +1213,9 @@ $content_actions: array of tabs
 'SkinTemplateToolboxEnd': Called by SkinTemplate skins after toolbox links have been rendered (useful for adding more)
 $tools: array of tools
 
+'SoftwareInfo': Called by Special:Version for returning information about the software
+$software: The array of software in format 'name' => 'version'. See SpecialVersion::softwareInformation()
+
 'SpecialContributionsBeforeMainOutput': Before the form on Special:Contributions
 $id: User identifier
 
@@ -1375,16 +1393,29 @@ $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
+
+'UserLoadAfterLoadFromSession': called to authenticate users on external/environmental means; occurs after session is loaded
+$user: user object being loaded
+
 'UserLoadDefaults': called when loading a default user
 $user: user object
 $name: user name
 
+'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
+'UserLoadOptions': when user options/preferences are being loaded from the database.
+$user: User object
+&$options: Options, can be modified.
 
 'UserLoginComplete': after a user has logged in
 $user: the user object that was created on login
@@ -1417,6 +1448,7 @@ $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)
@@ -1424,6 +1456,10 @@ $talks: array of new talks page(s)
 'UserSaveSettings': called when saving user settings
 $user: User object
 
+'UserSaveOptions': Called just before saving user preferences/options.
+$user: User object
+&$options: Options, modifiable
+
 'UserSetCookies': called when setting user cookies
 $user: User object
 &$session: session array, will be added to $_SESSION
@@ -1440,6 +1476,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
@@ -1448,6 +1488,12 @@ $article: article object to be watched
 $user: user that watched
 $article: article object watched
 
+'WikiExporter::dumpStableQuery': Get the SELECT query for "stable" revisions dumps
+One, and only one hook should set this, and return false.
+&$tables: Database tables to use in the SELECT query
+&$opts: Options to use for the query
+&$join: Join conditions
+
 'wgQueryPages': called when initialising $wgQueryPages, use this to add new query pages to be updated with maintenance/updateSpecialPages.php
 $query: $wgQueryPages itself