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 ); $session->persist(); $this->getResult()->addValue( null, $this->getModuleName(), $name ); } public function isWriteMode() { return true; } public function mustBePosted() { return true; } public function getHelpUrls() { return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:AcquireTempUserName'; } }