Merge "Hard-deprecate authentication-related hooks deprecated by AuthManager"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 10 Oct 2018 05:54:03 +0000 (05:54 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 10 Oct 2018 05:54:03 +0000 (05:54 +0000)
includes/auth/LegacyHookPreAuthenticationProvider.php
includes/specialpage/LoginSignupSpecialPage.php
tests/phpunit/includes/auth/LegacyHookPreAuthenticationProviderTest.php

index e8a276c..ad88564 100644 (file)
@@ -56,7 +56,7 @@ class LegacyHookPreAuthenticationProvider extends AbstractPreAuthenticationProvi
                }
 
                $msg = null;
-               if ( !\Hooks::run( 'LoginUserMigrated', [ $user, &$msg ] ) ) {
+               if ( !\Hooks::run( 'LoginUserMigrated', [ $user, &$msg ], '1.27' ) ) {
                        return $this->makeFailResponse(
                                $user, LoginForm::USER_MIGRATED, $msg, 'LoginUserMigrated'
                        );
@@ -64,7 +64,7 @@ class LegacyHookPreAuthenticationProvider extends AbstractPreAuthenticationProvi
 
                $abort = LoginForm::ABORTED;
                $msg = null;
-               if ( !\Hooks::run( 'AbortLogin', [ $user, $password, &$abort, &$msg ] ) ) {
+               if ( !\Hooks::run( 'AbortLogin', [ $user, $password, &$abort, &$msg ], '1.27' ) ) {
                        return $this->makeFailResponse( $user, $abort, $msg, 'AbortLogin' );
                }
 
@@ -74,7 +74,7 @@ class LegacyHookPreAuthenticationProvider extends AbstractPreAuthenticationProvi
        public function testForAccountCreation( $user, $creator, array $reqs ) {
                $abortError = '';
                $abortStatus = null;
-               if ( !\Hooks::run( 'AbortNewAccount', [ $user, &$abortError, &$abortStatus ] ) ) {
+               if ( !\Hooks::run( 'AbortNewAccount', [ $user, &$abortError, &$abortStatus ], '1.27' ) ) {
                        // Hook point to add extra creation throttles and blocks
                        $this->logger->debug( __METHOD__ . ': a hook blocked creation' );
                        if ( $abortStatus === null ) {
@@ -99,7 +99,7 @@ class LegacyHookPreAuthenticationProvider extends AbstractPreAuthenticationProvi
        public function testUserForCreation( $user, $autocreate, array $options = [] ) {
                if ( $autocreate !== false ) {
                        $abortError = '';
-                       if ( !\Hooks::run( 'AbortAutoAccount', [ $user, &$abortError ] ) ) {
+                       if ( !\Hooks::run( 'AbortAutoAccount', [ $user, &$abortError ], '1.27' ) ) {
                                // Hook point to add extra creation throttles and blocks
                                $this->logger->debug( __METHOD__ . ": a hook blocked auto-creation: $abortError\n" );
                                return $this->makeFailResponse(
index e39ec58..99a5a9a 100644 (file)
@@ -824,12 +824,12 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
 
                // Both Hooks::run are explicit here to make findHooks.php happy
                if ( $this->isSignup() ) {
-                       Hooks::run( 'UserCreateForm', [ &$template ] );
+                       Hooks::run( 'UserCreateForm', [ &$template ], '1.27' );
                        if ( $oldTemplate !== $template ) {
                                wfDeprecated( "reference in UserCreateForm hook", '1.27' );
                        }
                } else {
-                       Hooks::run( 'UserLoginForm', [ &$template ] );
+                       Hooks::run( 'UserLoginForm', [ &$template ], '1.27' );
                        if ( $oldTemplate !== $template ) {
                                wfDeprecated( "reference in UserLoginForm hook", '1.27' );
                        }
index 38ccb8a..4b89d25 100644 (file)
@@ -44,6 +44,8 @@ class LegacyHookPreAuthenticationProviderTest extends \MediaWikiTestCase {
                $this->mergeMwGlobalArrayValue( 'wgHooks', [
                        $hook => [ $mock ],
                ] );
+               $mockClass = get_class( $mock );
+               $this->hideDeprecated( "$hook hook (used in $mockClass::on$hook)" );
                return $mock->expects( $expect )->method( "on$hook" );
        }