Merge "Warn if stateful ParserOutput transforms are used"
[lhc/web/wiklou.git] / includes / auth / LegacyHookPreAuthenticationProvider.php
index 1a8a758..97bbde7 100644 (file)
@@ -96,7 +96,7 @@ class LegacyHookPreAuthenticationProvider extends AbstractPreAuthenticationProvi
                return StatusValue::newGood();
        }
 
-       public function testUserForCreation( $user, $autocreate ) {
+       public function testUserForCreation( $user, $autocreate, array $options = [] ) {
                if ( $autocreate !== false ) {
                        $abortError = '';
                        if ( !\Hooks::run( 'AbortAutoAccount', [ $user, &$abortError ] ) ) {
@@ -106,27 +106,6 @@ class LegacyHookPreAuthenticationProvider extends AbstractPreAuthenticationProvi
                                        $user, $user, LoginForm::ABORTED, $abortError, 'AbortAutoAccount'
                                );
                        }
-               } else {
-                       $abortError = '';
-                       $abortStatus = null;
-                       if ( !\Hooks::run( 'AbortNewAccount', [ $user, &$abortError, &$abortStatus ] ) ) {
-                               // Hook point to add extra creation throttles and blocks
-                               $this->logger->debug( __METHOD__ . ': a hook blocked creation' );
-                               if ( $abortStatus === null ) {
-                                       // Report back the old string as a raw message status.
-                                       // This will report the error back as 'createaccount-hook-aborted'
-                                       // with the given string as the message.
-                                       // To return a different error code, return a StatusValue object.
-                                       $msg = wfMessage( 'createaccount-hook-aborted' )->rawParams( $abortError );
-                                       return StatusValue::newFatal( $msg );
-                               } else {
-                                       // For MediaWiki 1.23+ and updated hooks, return the Status object
-                                       // returned from the hook.
-                                       $ret = StatusValue::newGood();
-                                       $ret->merge( $abortStatus );
-                                       return $ret;
-                               }
-                       }
                }
 
                return StatusValue::newGood();
@@ -136,9 +115,9 @@ class LegacyHookPreAuthenticationProvider extends AbstractPreAuthenticationProvi
         * Construct an appropriate failure response
         * @param User $user
         * @param User|null $creator
-        * @param int $constant LoginForm constant
-        * @param string|null $msg Message
-        * @param string $hook Hook
+        * @param int $constant One of the LoginForm::… constants
+        * @param string|null $msg Optional message key, will be derived from $constant otherwise
+        * @param string $hook Name of the hook for error logging and exception messages
         * @return StatusValue
         */
        protected function makeFailResponse( $user, $creator, $constant, $msg, $hook ) {