27use Wikimedia\ScopedCallback;
41 parent::__construct(
'Invalidateemail',
'editmyprivateinfo' );
43 $this->userFactory = $userFactory;
59 $scope = $trxProfiler->silenceForScope( $trxProfiler::EXPECTATION_REPLICAS_ONLY );
60 $this->attemptInvalidate( $code );
61 ScopedCallback::consume( $scope );
70 private function attemptInvalidate( $code ) {
71 $user = $this->userFactory->newFromConfirmationCode(
73 IDBAccessObject::READ_LATEST
76 if ( !is_object( $user ) ) {
77 $this->
getOutput()->addWikiMsg(
'confirmemail_invalid' );
82 $userLatest = $user->getInstanceForUpdate();
83 $userLatest->invalidateEmail();
84 $userLatest->saveSettings();
85 $this->
getOutput()->addWikiMsg(
'confirmemail_invalidated' );
87 if ( !$this->
getUser()->isRegistered() ) {
94class_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.