Rewritten the way the API handles tokens:
[lhc/web/wiklou.git] / docs / hooks.txt
index e0373bf..6f76b5c 100644 (file)
@@ -254,11 +254,11 @@ $old: old title
 $nt: new title
 $user: user who is doing the move
 $err: error message
+$reason: the reason for the move (added in 1.13)
 
 'AbortNewAccount': Return false to cancel account creation.
 $user: the User object about to be created (read-only, incomplete)
 $message: out parameter: error message to display on abort
-$autocreate: whether the account is being automatically created.
 
 'AddNewAccount': after a user account is created
 $user: the User object that was created. (Parameter added in 1.7)
@@ -281,6 +281,28 @@ $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
 
+'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
+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)
+where $pageid is the page ID of the page the token is requested for
+and $title is the associated Title object. In the hook, just add
+your callback to the $tokenFunctions array and return true (returning
+false makes no sense)
+$tokenFunctions: array(action => callback)
+
+'APIQueryRevisionsTokens': use this hook to add custom tokens to prop=revisions.
+Every token has an action, which will be used in the rvtoken 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, $rev)
+where $pageid is the page ID of the page associated to the revision the
+token is requested for, $title the associated Title object and $rev the
+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)
+
 '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
@@ -289,6 +311,8 @@ $content: the content (string) of the article
 $article: the article (object) being deleted
 $user: the user (object) deleting the article
 $reason: the reason (string) the article is being deleted
+$error: if the deletion was prohibited, the (raw HTML) error message to display
+  (added in 1.13)
 
 'ArticleDeleteComplete': after an article is deleted
 $article: the article that was deleted
@@ -306,7 +330,7 @@ $article: article (object) being modified
 $title: title (object) used to create the article object
 $article: article (object) that will be returned
 
-'ArticleInsertComplete': After an article is created
+'ArticleInsertComplete': After a new article is created
 $article: Article created
 $user: User creating the article
 $text: New content
@@ -524,11 +548,13 @@ $editor: Edit form (see includes/EditPage.php)
 $text: Contents of the edit box
 $section: Section being edited
 &$error: Error message to return
+$summary: Edit summary for page
 
 'EditFilterMerged': Post-section-merge edit filter
 $editor: EditPage instance (object)
 $text: content of the edit box
 $error: error message to return
+$summary: Edit summary for page
 
 'EditFormPreloadText': Allows population of the edit form when creating new pages
 &$text: Text to preload with
@@ -619,6 +645,10 @@ $fileVersions: array of undeleted versions. Empty if all versions were restored
 $user: user who performed the undeletion
 $reason: reason
 
+'GetAutoPromoteGroups': When determining which autopromote groups a user is entitled to be in.
+&$user: user to promote.
+&$promote: groups that will be added.
+
 'GetBlockedStatus': after loading blocking status of an user from the database
 $user: user (object) being checked
 
@@ -690,6 +720,12 @@ $page: ImagePage object
 &$file: File object
 &$displayFile: displayed File object
 
+'InitializeArticleMaybeRedirect': MediaWiki check to see if title is a redirect
+$title: Title object ($wgTitle)
+$request: WebRequest
+$ignoreRedirect: boolean to skip redirect check
+$target: Title/string of redirect target
+
 'InitPreferencesForm': called at the end of PreferencesForm's constructor
 $form: the PreferencesForm
 $request: the web request to initialized from
@@ -725,6 +761,16 @@ $lang: laguage code (string)
 $specialPageAliases: associative array of magic words synonyms
 $lang: laguage code (string)
 
+'LinkerMakeExternalImage': At the end of Linker::makeExternalImage() just before the return
+&$url: the image url
+&$alt: the image's alt text
+&$img: the new image HTML (if returning false)
+
+'LinkerMakeExternalLink': At the end of Linker::makeExternalLink() just before the return
+&$url: the link url
+&$text: the link text
+&$link: the new link HTML (if returning false)
+
 'LinksUpdate': At the beginning of LinksUpdate::doUpdate() just before the actual update
 &$linksUpdate: the LinkUpdate object
 
@@ -738,6 +784,14 @@ $lang: laguage code (string)
 
 'LoadExtensionSchemaUpdates': called by maintenance/updaters.inc when upgrading database schema
 
+'LocalFile::getHistory': called before file history query performed
+$file: the file
+$tables: tables
+$fields: select fields
+$conds: conditions
+$opts: query options
+$join_conds: JOIN conditions
+
 '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
@@ -799,6 +853,7 @@ $article: $wgArticle
 $title:   $wgTitle
 $user:    $wgUser
 $request: $wgRequest
+$this:    The $mediawiki object
 
 'MessagesPreLoad': When loading a message from the database
 $title: title of the message (string)
@@ -815,6 +870,10 @@ $article: the article edited
 $rev: the new revision
 $baseID: the revision ID this was based off, if any
 
+'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
+
 'OutputPageBeforeHTML': a page has been processed by the parser and
 the resulting HTML is about to be displayed.  
 $parserOutput: the parserOutput (object) that corresponds to the page 
@@ -824,6 +883,12 @@ $text: the text that will be displayed, in HTML (string)
 $out: OutputPage instance (object)
 $parserOutput: parserOutput instance being added in $out
 
+'OutputPageMakeCategoryLinks': links are about to be generated for the page's categories.
+  Implementations should return false if they generate the category links, so the default link generation is skipped.
+$out: OutputPage instance (object)
+$categories: associative array, keys are category names, values are category types ("normal" or "hidden")
+$links: array, intended to hold the result. Must be an associative array with category types as keys and arrays of HTML links as values.
+
 'PageHistoryBeforeList': When a history page list is about to be constructed.
 $article: the article that the history is loading for
 
@@ -1083,13 +1148,23 @@ $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
 
+'SpecialRecentChangesPanel': called when building form options in SpecialRecentChanges
+&$extraOpts: array of added items, to which can be added
+$opts: FormOptions for this request
+
+'SpecialRecentChangesQuery': called when building sql query for SpecialRecentChanges
+&$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
+
 '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
 
 'SpecialSearchResults': called before search result display when there are matches
 $term: string of search term
-$titleMatches: empty or SearchResultSet object
-$textMatches: empty or SearchResultSet object
+&$titleMatches: empty or SearchResultSet object
+&$textMatches: empty or SearchResultSet object
 
 'SpecialSearchNoResults': called before search result display when there are no matches
 $term: string of search term
@@ -1189,6 +1264,10 @@ $user: User object
 $user: User to get rights for
 &$rights: Current rights
 
+'UserLoadDefaults': called when loading a default user
+$user: user object
+$name: user name
+
 'UserLoadFromSession': called to authenticate users on external/environmental means
 $user: user object being loaded
 &$result: set this to a boolean value to abort the normal authentification process
@@ -1220,6 +1299,11 @@ $talks: array of new talks page(s)
 'UserSaveSettings': called when saving user settings
 $user: User object
 
+'UserSetCookies': called when setting user cookies
+$user: User object
+&$session: session array, will be added to $_SESSION
+&$cookies: cookies array mapping cookie name to its value
+
 'UserSetEmail': called when changing user email address
 $user: User object
 &$email: new email, change this to override new email address