29use Wikimedia\ScopedCallback;
45 parent::__construct(
'Invalidateemail',
'editmyprivateinfo' );
47 $this->userFactory = $userFactory;
63 $scope = $trxProfiler->silenceForScope( $trxProfiler::EXPECTATION_REPLICAS_ONLY );
64 $this->attemptInvalidate( $code );
65 ScopedCallback::consume( $scope );
74 private function attemptInvalidate( $code ) {
75 $user = $this->userFactory->newFromConfirmationCode(
77 UserFactory::READ_LATEST
80 if ( !is_object( $user ) ) {
81 $this->
getOutput()->addWikiMsg(
'confirmemail_invalid' );
86 $user->invalidateEmail();
87 $user->saveSettings();
88 $this->
getOutput()->addWikiMsg(
'confirmemail_invalidated' );
90 if ( !$this->
getUser()->isRegistered() ) {
99class_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.