Merge "Handle missing namespace prefix in XML dumps more gracefully"
[lhc/web/wiklou.git] / docs / hooks.txt
index 4057cce..846a073 100644 (file)
@@ -212,9 +212,13 @@ related to a particular event, like so:
                # ...
                function protect() {
                        global $wgUser;
-                       if ( Hooks::run( 'ArticleProtect', array( &$this, &$wgUser ) ) ) {
+
+                       // Avoid PHP 7.1 warning from passing $this by reference
+                       $article = $this;
+
+                       if ( Hooks::run( 'ArticleProtect', [ &$article, &$wgUser ] ) ) {
                                # protect the article
-                               Hooks::run( 'ArticleProtectComplete', array( &$this, &$wgUser ) );
+                               Hooks::run( 'ArticleProtectComplete', [ &$article, &$wgUser ] );
                        }
                }
        }
@@ -365,6 +369,11 @@ $user: Current user
  * 1.27+: IApiMessage, or a key or key+parameters in ApiBase::$messageMap.
  * Earlier: A key or key+parameters in ApiBase::$messageMap.
 
+'ApiDeprecationHelp': Add messages to the 'deprecation-help' warning generated
+from ApiBase::addDeprecation().
+&$msgs: Message[] Messages to include in the help. Multiple messages will be
+  joined with spaces.
+
 'APIEditBeforeSave': DEPRECATED! Use EditFilterMergedContent instead.
 Before saving a page with api.php?action=edit, after
 processing request parameters. Return false to let the request fail, returning
@@ -1083,6 +1092,8 @@ $title: the Title in question
 'ContentHandlerForModelID': Called when a ContentHandler is requested for
 a given content model name, but no entry for that model exists in
 $wgContentHandlers.
+Note: if your extension implements additional models via this hook, please
+use GetContentModels hook to make them known to core. 
 $modeName: the requested content model name
 &$handler: set this to a ContentHandler object, if desired.
 
@@ -1553,6 +1564,9 @@ notifications.
 &$url: string value as output (out parameter, can modify)
 $query: query options passed to Title::getCanonicalURL()
 
+'GetContentModels': Add content models to the list of available models.
+&$models: array containing current model list, as strings. Extensions should add to this list.
+
 'GetDefaultSortkey': Override the default sortkey for a page.
 $title: Title object that we need to get a sortkey for
 &$sortkey: Sortkey to use.
@@ -2822,12 +2836,12 @@ $terms: Search terms, for highlighting
   function returned false.
 
 'ShowSearchHitTitle': Customise display of search hit title/link.
-$title: Title to link to
-&$text: Text to use for the link
-$result: The search result
-$terms: The search terms entered
-$page: The SpecialSearch object
-&$query: Query string to be appended to the link
+&$title: Title to link to
+&$titleSnippet: Label for the link representing the search result. Typically the article title.
+$result: The SearchResult object
+$terms: String of the search terms entered
+$specialSearch: The SpecialSearch object
+&$query: Array of query string parameters for the link representing the search result.
 
 'SidebarBeforeOutput': Allows to edit sidebar just before it is output by skins.
 Warning: This hook is run on each display. You should consider to use
@@ -3148,8 +3162,8 @@ $opts: Array: key => value of hidden options for inclusion in custom forms
 
 'SpecialSearchResults': Called before search result display
 $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
 
 'SpecialSearchResultsPrepend': Called immediately before returning HTML
 on the search results page.  Useful for including an external search
@@ -3452,10 +3466,12 @@ temporary password
 &$ip: IP of the user who sent the message out
 &$u: the account whose new password will be set
 
-'UserAddGroup': Called when adding a group; return false to override
-stock group addition.
+'UserAddGroup': Called when adding a group or changing a group's expiry; return
+false to override stock group addition.
 $user: the user object that is to have a group added
-&$group: the group to add, can be modified
+&$group: the group to add; can be modified
+&$expiry: the expiry time in TS_MW format, or null if the group is not to
+expire; can be modified
 
 'UserArrayFromResult': Called when creating an UserArray object from a database
 result.
@@ -3698,7 +3714,8 @@ their data into the cache array so that things like global user groups are
 displayed correctly in Special:ListUsers.
 $dbr: Read-only database handle
 $userIds: Array of user IDs whose groups we should look up
-&$cache: Array of user ID -> internal user group name (e.g. 'sysop') mappings
+&$cache: Array of user ID -> (array of internal group name (e.g. 'sysop') ->
+UserGroupMembership object)
 &$groups: Array of group name -> bool true mappings for members of a given user
 group