Movatterモバイル変換


[0]ホーム

URL:


MediaWiki master
SpecialEmailInvalidate.php
Go to the documentation of this file.
1<?php
7namespaceMediaWiki\Specials;
8
9use LogicException;
10useMediaWiki\SpecialPage\UnlistedSpecialPage;
11useMediaWiki\User\UserFactory;
12useProfiler;
13useWikimedia\Rdbms\IDBAccessObject;
14use Wikimedia\ScopedCallback;
15
23classSpecialEmailInvalidateextendsUnlistedSpecialPage {
24
25privateUserFactory $userFactory;
26
27publicfunction__construct(UserFactory $userFactory ) {
28 parent::__construct('Invalidateemail','editmyprivateinfo' );
29
30 $this->userFactory = $userFactory;
31 }
32
34publicfunctiondoesWrites() {
35returntrue;
36 }
37
39publicfunctionexecute( $code ) {
40// Ignore things like primary queries/connections on GET requests.
41// It's very convenient to just allow formless link usage.
42 $trxProfiler =Profiler::instance()->getTransactionProfiler();
43
44 $this->setHeaders();
45 $this->checkReadOnly();
46 $this->checkPermissions();
47
48 $scope = $trxProfiler->silenceForScope( $trxProfiler::EXPECTATION_REPLICAS_ONLY );
49 $this->attemptInvalidate( $code );
50 ScopedCallback::consume( $scope );
51 }
52
59privatefunction attemptInvalidate( $code ) {
60 $user = $this->userFactory->newFromConfirmationCode(
61 (string)$code,
62 IDBAccessObject::READ_LATEST
63 );
64
65if ( !is_object( $user ) ) {
66 $this->getOutput()->addWikiMsg('confirmemail_invalid' );
67
68return;
69 }
70
71 $userLatest = $user->getInstanceFromPrimary() ??thrownew LogicException('No user' );
72 $userLatest->invalidateEmail();
73 $userLatest->saveSettings();
74 $this->getOutput()->addWikiMsg('confirmemail_invalidated' );
75
76if ( !$this->getUser()->isRegistered() ) {
77 $this->getOutput()->returnToMain();
78 }
79 }
80}
81
83class_alias( SpecialEmailInvalidate::class,'SpecialEmailInvalidate' );
MediaWiki\SpecialPage\SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
DefinitionSpecialPage.php:685
MediaWiki\SpecialPage\SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
DefinitionSpecialPage.php:884
MediaWiki\SpecialPage\SpecialPage\checkPermissions
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
DefinitionSpecialPage.php:387
MediaWiki\SpecialPage\SpecialPage\checkReadOnly
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
DefinitionSpecialPage.php:400
MediaWiki\SpecialPage\SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
DefinitionSpecialPage.php:874
MediaWiki\SpecialPage\UnlistedSpecialPage
Shortcut to construct a special page which is unlisted by default.
DefinitionUnlistedSpecialPage.php:19
MediaWiki\Specials\SpecialEmailInvalidate
Cancel an email confirmation using the e-mail confirmation code.
DefinitionSpecialEmailInvalidate.php:23
MediaWiki\Specials\SpecialEmailInvalidate\execute
execute( $code)
Default execute method Checks user permissions.This must be overridden by subclasses; it will be made...
DefinitionSpecialEmailInvalidate.php:39
MediaWiki\Specials\SpecialEmailInvalidate\doesWrites
doesWrites()
Indicates whether POST requests to this special page require write access to the wiki....
DefinitionSpecialEmailInvalidate.php:34
MediaWiki\Specials\SpecialEmailInvalidate\__construct
__construct(UserFactory $userFactory)
DefinitionSpecialEmailInvalidate.php:27
MediaWiki\User\UserFactory
Create User objects.
DefinitionUserFactory.php:32
Profiler
Profiler base class that defines the interface and some shared functionality.
DefinitionProfiler.php:22
Profiler\instance
static instance()
DefinitionProfiler.php:90
Wikimedia\Rdbms\IDBAccessObject
Interface for database access objects.
DefinitionIDBAccessObject.php:45
MediaWiki\Specials

[8]ページ先頭

©2009-2025 Movatter.jp