X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fspecials%2FSpecialUserlogin.php;h=eca183986414cb92f83c5ff3cee5124b479a4616;hb=c8e3c424f9ddd929b4ddfae61f39f94b2894b467;hp=8e5ef581263626a14c071ec75b4773f19fd5b4ad;hpb=2fc330138eae41dde63ef0fd935f7b1fe2763c8d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 8e5ef58126..eca1839864 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -444,12 +444,23 @@ class LoginForm extends SpecialPage { $u->setRealName( $this->mRealName ); $abortError = ''; - if ( !wfRunHooks( 'AbortNewAccount', array( $u, &$abortError ) ) ) { + $abortStatus = null; + if ( !wfRunHooks( 'AbortNewAccount', array( $u, &$abortError, &$abortStatus ) ) ) { // Hook point to add extra creation throttles and blocks wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" ); - $abortError = new RawMessage( $abortError ); - $abortError->text(); - return Status::newFatal( $abortError ); + 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 Status object. + $abortError = new Message( 'createaccount-hook-aborted', array( $abortError ) ); + $abortError->text(); + return Status::newFatal( $abortError ); + } else { + // For MediaWiki 1.23+ and updated hooks, return the Status object + // returned from the hook. + return $abortStatus; + } } // Hook point to check for exempt from account creation throttle