14use Wikimedia\ScopedCallback;
28 parent::__construct(
'Invalidateemail',
'editmyprivateinfo' );
30 $this->userFactory = $userFactory;
48 $scope = $trxProfiler->silenceForScope( $trxProfiler::EXPECTATION_REPLICAS_ONLY );
49 $this->attemptInvalidate( $code );
50 ScopedCallback::consume( $scope );
59 private function attemptInvalidate( $code ) {
60 $user = $this->userFactory->newFromConfirmationCode(
62 IDBAccessObject::READ_LATEST
65 if ( !is_object( $user ) ) {
66 $this->
getOutput()->addWikiMsg(
'confirmemail_invalid' );
71 $userLatest = $user->getInstanceFromPrimary() ??
throw new LogicException(
'No user' );
72 $userLatest->invalidateEmail();
73 $userLatest->saveSettings();
74 $this->
getOutput()->addWikiMsg(
'confirmemail_invalidated' );
76 if ( !$this->
getUser()->isRegistered() ) {
83class_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.
Profiler base class that defines the interface and some shared functionality.