14use Wikimedia\ScopedCallback;
28 parent::__construct(
'Invalidateemail',
'editmyprivateinfo' );
40 $trxProfiler = Profiler::instance()->getTransactionProfiler();
46 $scope = $trxProfiler->silenceForScope( $trxProfiler::EXPECTATION_REPLICAS_ONLY );
47 $this->attemptInvalidate( $code );
48 ScopedCallback::consume( $scope );
57 private function attemptInvalidate( $code ) {
58 $user = $this->userFactory->newFromConfirmationCode(
60 IDBAccessObject::READ_LATEST
63 if ( !is_object( $user ) ) {
64 $this->
getOutput()->addWikiMsg(
'confirmemail_invalid' );
69 $userLatest = $user->getInstanceFromPrimary() ??
throw new LogicException(
'No user' );
70 $userLatest->invalidateEmail();
71 $userLatest->saveSettings();
72 $this->
getOutput()->addWikiMsg(
'confirmemail_invalidated' );
74 if ( !$this->
getUser()->isRegistered() ) {
81class_alias( SpecialEmailInvalidate::class,
'SpecialEmailInvalidate' );
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
getOutput()
Get the OutputPage being used for this instance.
Shortcut to construct a special page which is unlisted by default.