getUserFactory(); $user = $userFactory->newFromName( $accountName ); $creator = $creator ?? $user; $provider = new AbuseFilterPreAuthenticationProvider( AbuseFilterServices::getVariableGeneratorFactory(), AbuseFilterServices::getFilterRunnerFactory(), new NullStatsdDataFactory(), $userFactory ); if ( $autocreate ) { $status = $provider->testUserForCreation( $user, $autocreate ); } else { $status = $provider->testForAccountCreation( $user, $creator, [] ); } if ( $status->isGood() ) { // A creatable username must exist to be passed to $logEntry->setPerformer(), // so create the account. $user->addToDatabase(); // FIXME This is a bit hacky, but AuthManager doesn't expose any methods for logging $subType = $autocreate ? 'autocreate' : 'create2'; $logEntry = new ManualLogEntry( 'newusers', $subType ); $logEntry->setPerformer( $creator ); $logEntry->setTarget( PageReferenceValue::localReference( NS_USER, $accountName ) ); $logEntry->setComment( 'Fooobarcomment' ); $logEntry->setParameters( [ '4::userid' => $user->getId(), ] ); $logid = $logEntry->insert(); $logEntry->publish( $logid ); $status->value = $logid; } return $status; } }