tempUserCreator = $tempUserCreator; } public function execute() { // Like TempUserCreator::shouldAutoCreate(), but without the action check if ( !$this->tempUserCreator->isEnabled() ) { $this->dieWithError( 'apierror-tempuserdisabled', 'tempuserdisabled' ); } if ( $this->getUser()->isRegistered() ) { $this->dieWithError( 'apierror-alreadyregistered', 'alreadyregistered' ); } $this->checkUserRightsAny( 'createaccount' ); // Checks passed, acquire the name $session = $this->getRequest()->getSession(); $name = $this->tempUserCreator->acquireAndStashName( $session ); if ( $name === null ) { $this->dieWithError( 'apierror-tempuseracquirefailed', 'tempuseracquirefailed' ); } $session->persist(); $this->getResult()->addValue( null, $this->getModuleName(), $name ); } public function isWriteMode() { return true; } public function mustBePosted() { return true; } } /** @deprecated class alias since 1.43 */ class_alias( ApiAcquireTempUserName::class, 'ApiAcquireTempUserName' );