Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4095604
SuggestedInvestigationsHandler.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
SuggestedInvestigationsHandler.php
View Options
<?php
namespace
MediaWiki\CheckUser\HookHandler
;
use
MediaWiki\Auth\Hook\LocalUserCreatedHook
;
use
MediaWiki\CheckUser\SuggestedInvestigations\Services\SuggestedInvestigationsSignalMatchService
;
use
MediaWiki\Deferred\DeferredUpdates
;
use
MediaWiki\User\Hook\UserSetEmailAuthenticationTimestampHook
;
use
MediaWiki\User\Hook\UserSetEmailHook
;
use
MediaWiki\User\UserIdentity
;
/**
* Listens for events that trigger suggested investigation signals to be matched against a user.
*/
class
SuggestedInvestigationsHandler
implements
LocalUserCreatedHook
,
UserSetEmailHook
,
UserSetEmailAuthenticationTimestampHook
{
public
function
__construct
(
private
readonly
SuggestedInvestigationsSignalMatchService
$suggestedInvestigationsSignalMatchService
)
{
}
/** @inheritDoc */
public
function
onLocalUserCreated
(
$user
,
$autocreated
):
void
{
$this
->
matchSignalsAgainstUserOnDeferredUpdate
(
$user
,
$autocreated
?
SuggestedInvestigationsSignalMatchService
::
EVENT_AUTOCREATE_ACCOUNT
:
SuggestedInvestigationsSignalMatchService
::
EVENT_CREATE_ACCOUNT
);
}
/** @inheritDoc */
public
function
onUserSetEmail
(
$user
,
&
$email
):
void
{
$this
->
matchSignalsAgainstUserOnDeferredUpdate
(
$user
,
SuggestedInvestigationsSignalMatchService
::
EVENT_SET_EMAIL
);
}
/** @inheritDoc */
public
function
onUserSetEmailAuthenticationTimestamp
(
$user
,
&
$timestamp
):
void
{
$this
->
matchSignalsAgainstUserOnDeferredUpdate
(
$user
,
SuggestedInvestigationsSignalMatchService
::
EVENT_CONFIRM_EMAIL
);
}
private
function
matchSignalsAgainstUserOnDeferredUpdate
(
UserIdentity
$userIdentity
,
string
$eventType
):
void
{
DeferredUpdates
::
addCallableUpdate
(
function
()
use
(
$userIdentity
,
$eventType
)
{
$this
->
suggestedInvestigationsSignalMatchService
->
matchSignalsAgainstUser
(
$userIdentity
,
$eventType
);
}
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 13:57 (4 w, 7 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
56/d9/c91323e70945bf70727a359abf49
Default Alt Text
SuggestedInvestigationsHandler.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment