Fully deprecate 'ContentAction' hook
authorrlot <rj23@protonmail.com>
Mon, 2 Jan 2017 13:48:31 +0000 (14:48 +0100)
committerReedy <reedy@wikimedia.org>
Mon, 2 Jan 2017 18:35:06 +0000 (18:35 +0000)
Bug: T54027
Change-Id: Ia765e25a9f76b34f7b10125d3b6e0c8e00fac2ca

RELEASE-NOTES-1.29
docs/hooks.txt
includes/MediaWiki.php

index 14b5692..f2d738a 100644 (file)
@@ -152,6 +152,8 @@ changes to languages because of Phabricator reports.
 * Class ImageGallery (deprecated in 1.22) was removed.
   Use ImageGalleryBase::factory instead.
 * Title::moveNoAuth() (deprecated in 1.25) was removed. Use MovePage class instead.
+* Hook UnknownAction (deprecated in 1.19) was actually deprecated (it will now emit warnings).
+  Create a subclass of Action, and add it to $wgActions instead.
 
 == Compatibility ==
 
index e8335cd..2f99fff 100644 (file)
@@ -3420,8 +3420,9 @@ Since 1.24: Paths pointing to a directory will be recursively scanned for
 test case files matching the suffix "Test.php".
 &$paths: list of test cases and directories to search.
 
-'UnknownAction': An unknown "action" has occurred (useful for defining your own
-actions).
+'UnknownAction': DEPRECATED! To add an action in an extension,
+create a subclass of Action, and add a new key to $wgActions.
+An unknown "action" has occurred (useful for defining your own actions).
 $action: action name
 $article: article "acted on"
 
index eaa1c99..faca533 100644 (file)
@@ -495,8 +495,15 @@ class MediaWiki {
                        $action->show();
                        return;
                }
-
-               if ( Hooks::run( 'UnknownAction', [ $request->getVal( 'action', 'view' ), $page ] ) ) {
+               // NOTE: deprecated hook. Add to $wgActions instead
+               if ( Hooks::run(
+                       'UnknownAction',
+                       [
+                               $request->getVal( 'action', 'view' ),
+                               $page
+                       ],
+                       '1.19'
+               ) ) {
                        $output->setStatusCode( 404 );
                        $output->showErrorPage( 'nosuchaction', 'nosuchactiontext' );
                }