Merge "Avoid a few overly complicated is_null() checks"
[lhc/web/wiklou.git] / docs / hooks.txt
index 28065fc..9e6ed10 100644 (file)
@@ -226,14 +226,9 @@ Hooks::run() returns true if the calling function should continue processing
 error occurred, or one of the hooks handled the action already). Checking the
 return value matters more for "before" hooks than for "complete" hooks.
 
-Hooks::run() was added in MediaWiki 1.18, before that the global function
-wfRunHooks must be used, which was deprecated in MediaWiki 1.25.
-
 Note that hook parameters are passed in an array; this is a necessary
-inconvenience to make it possible to pass reference values (that can be changed)
-into the hook code. Also note that earlier versions of wfRunHooks took a
-variable number of arguments; the array calling protocol came about after
-MediaWiki 1.4rc1.
+inconvenience to make it possible to pass reference values (which can be changed)
+by the hook callback.
 
 ==Events and parameters==
 
@@ -792,16 +787,6 @@ $extraData: An array (string => string) with extra information, intended to be
   added to log contexts. Fields it might include:
   - appId: the application ID, only if the login was with a bot password
 
-'AuthPluginAutoCreate': DEPRECATED since 1.27! Use the 'LocalUserCreated' hook
-instead. Called when creating a local account for an user logged in from an
-external authentication method.
-$user: User object created locally
-
-'AuthPluginSetup': DEPRECATED since 1.27! Extensions should be updated to use
-AuthManager. Update or replace authentication plugin object ($wgAuth). Gives a
-chance for an extension to set it programmatically to a variable class.
-&$auth: the $wgAuth object, probably a stub
-
 'AutopromoteCondition': Check autopromote condition for user.
 $type: condition type
 $args: arguments
@@ -2446,10 +2431,12 @@ $flags: Flags passed to WikiPage::doEditContent()
 $revision: New Revision of the article
 
 'PageContentLanguage': Allows changing the language in which the content of a
-page is written. Defaults to the wiki content language ($wgContLang).
+page is written. Defaults to the wiki content language.
 $title: Title object
-&$pageLang: the page content language (either an object or a language code)
-$wgLang: the user language
+&$pageLang: the page content language. Input can be anything (under control of
+  hook subscribers), but hooks should return Language objects. Language code
+  strings are deprecated.
+$userLang: the user language (Language or StubUserLang object)
 
 'PageContentSave': Before an article is saved.
 $wikiPage: the WikiPage (object) being saved
@@ -2838,17 +2825,17 @@ such as when responding to a resource
 loader request or generating HTML output.
 &$resourceLoader: ResourceLoader object
 
-'ResourceLoaderTestModules': Let you add new JavaScript testing modules. This is
-called after the addition of 'qunit' and MediaWiki testing resources.
-&$testModules: array of JavaScript testing modules. The 'qunit' framework,
-  included in core, is fed using tests/qunit/QUnitTestResources.php.
-  To add a new qunit module named 'myext.tests':
-       $testModules['qunit']['myext.tests'] = [
-               'script' => 'extension/myext/tests.js',
-               'dependencies' => <any module dependency you might have>
+'ResourceLoaderTestModules': DEPRECATED since 1.33! Register ResourceLoader modules
+that are only available when `$wgEnableJavaScriptTest` is true. Use this for test
+suites and other test-only resources.
+&$testModules: one array of modules per test framework. The modules array
+follows the same format as `$wgResourceModules`. For example:
+       $testModules['qunit']['ext.Example.test'] = [
+               'localBasePath' => __DIR__ . '/tests/qunit',
+               'remoteExtPath' => 'Example/tests/qunit',
+               'script' => [ 'tests/qunit/foo.js' ],
+               'dependencies' => [ 'ext.Example.foo' ]
         ];
-  For QUnit framework, the mediawiki.tests.qunit.testrunner dependency will be
-  added to any module.
 &$ResourceLoader: object
 
 'RevisionDataUpdates': Called when constructing a list of DeferrableUpdate to be
@@ -3842,6 +3829,23 @@ the database) have been saved. Compare to the UserSaveOptions hook, which is
 called before.
 $user: The User for which the options have been saved
 
+'UserSendConfirmationMail': Called just before a confirmation email is sent to
+a user. Hook handlers can modify the email that will be sent.
+$user: The User for which the confirmation email is going to be sent
+&$mail: Associative array describing the email, with the following keys:
+  - subject: Subject line of the email
+  - body: Email body. Can be a string, or an array with keys 'text' and 'html'
+  - from: User object, or null meaning $wgPasswordSender will be used
+  - replyTo: MailAddress object or null
+$info: Associative array with additional information:
+  - type: 'created' if the user's account was just created; 'set' if the user
+    set an email address when they previously didn't have one; 'changed' if
+    the user had an email address and changed it
+  - ip: The IP address from which the user set/changed their email address
+  - confirmURL: URL the user should visit to confirm their email
+  - invalidateURL: URL the user should visit to invalidate confirmURL
+  - expiration: time and date when confirmURL expires
+
 'UserSetCookies': DEPRECATED since 1.27! If you're trying to replace core
 session cookie handling, you want to create a subclass of
 MediaWiki\Session\CookieSessionProvider instead. Otherwise, you can no longer