27use Wikimedia\ScopedCallback;
44 parent::__construct(
'Invalidateemail',
'editmyprivateinfo' );
46 $this->userFactory = $userFactory;
62 $scope = $trxProfiler->silenceForScope( $trxProfiler::EXPECTATION_REPLICAS_ONLY );
63 $this->attemptInvalidate( $code );
64 ScopedCallback::consume( $scope );
73 private function attemptInvalidate( $code ) {
74 $user = $this->userFactory->newFromConfirmationCode(
76 IDBAccessObject::READ_LATEST
79 if ( !is_object( $user ) ) {
80 $this->
getOutput()->addWikiMsg(
'confirmemail_invalid' );
85 $user->invalidateEmail();
86 $user->saveSettings();
87 $this->
getOutput()->addWikiMsg(
'confirmemail_invalidated' );
89 if ( !$this->
getUser()->isRegistered() ) {
96class_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.