}
$msg = null;
- if ( !\Hooks::run( 'LoginUserMigrated', [ $user, &$msg ] ) ) {
+ if ( !\Hooks::run( 'LoginUserMigrated', [ $user, &$msg ], '1.27' ) ) {
return $this->makeFailResponse(
- $user, null, LoginForm::USER_MIGRATED, $msg, 'LoginUserMigrated'
+ $user, LoginForm::USER_MIGRATED, $msg, 'LoginUserMigrated'
);
}
$abort = LoginForm::ABORTED;
$msg = null;
- if ( !\Hooks::run( 'AbortLogin', [ $user, $password, &$abort, &$msg ] ) ) {
- return $this->makeFailResponse( $user, null, $abort, $msg, 'AbortLogin' );
+ if ( !\Hooks::run( 'AbortLogin', [ $user, $password, &$abort, &$msg ], '1.27' ) ) {
+ return $this->makeFailResponse( $user, $abort, $msg, 'AbortLogin' );
}
return StatusValue::newGood();
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 ) {
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(
- $user, $user, LoginForm::ABORTED, $abortError, 'AbortAutoAccount'
+ $user, LoginForm::ABORTED, $abortError, 'AbortAutoAccount'
);
}
}
/**
* Construct an appropriate failure response
* @param User $user
- * @param User|null $creator
* @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 ) {
+ private function makeFailResponse( User $user, $constant, $msg, $hook ) {
switch ( $constant ) {
case LoginForm::SUCCESS:
// WTF?
case LoginForm::USER_MIGRATED:
$error = $msg ?: 'login-migrated-generic';
- return call_user_func_array( 'StatusValue::newFatal', (array)$error );
+ return StatusValue::newFatal( ...(array)$error );
// @codeCoverageIgnoreStart
case LoginForm::CREATE_BLOCKED: // Can never happen