mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
Send AbuseFilter logs to CheckUser on PRESEND
Why: * AbuseFilter can send AbuseFilter logs to CheckUser if they are not being sent to Special:RecentChanges. * However, if this action is indirectly causing the creation of an account (such as through temporary account auto-creation), the log entry is sent to CheckUser before the temporary account actually exists in the 'user' table. * This causes a CannotCreateActorException, as the performer does not exist on the wiki just yet and therefore cannot have an actor ID until the temporary account is created. * This exception can happen if the AbuseFilter filter only creates a log entry and does not prevent the edit, so would not be necessarily fixed by T334623. * Sending the logs to CheckUser on PRESEND avoids this, as the user will exist by the time that PRESEND is run but still allows any failures to cause an exception which can be seen by the user. What: * Wrap the call to Hooks::updateCheckUserData in AbuseLogger ::insertLocalLogEntries in a DeferredUpdate which is set to run on PRESEND. Bug: T358632 Change-Id: Ia615fce3e26b88d5457ecc01231044b326b79973
This commit is contained in:
parent
c78e07c75c
commit
f3c87749b8
|
@ -248,7 +248,12 @@ class AbuseLogger {
|
|||
$entry->setPerformer( new UserIdentityValue( 0, $this->requestIP ) );
|
||||
}
|
||||
$rc = $entry->getRecentChange();
|
||||
Hooks::updateCheckUserData( $rc );
|
||||
// We need to send the entries on PRESEND to ensure that the user definitely exists.
|
||||
// A temporary account being created through an edit will not exist until after AbuseFilter
|
||||
// processes the edit and attempts to log to CheckUser.
|
||||
DeferredUpdates::addCallableUpdate( static function () use ( $rc ) {
|
||||
Hooks::updateCheckUserData( $rc );
|
||||
}, DeferredUpdates::PRESEND );
|
||||
}
|
||||
|
||||
if ( $this->options->get( 'AbuseFilterNotifications' ) !== false ) {
|
||||
|
|
Loading…
Reference in a new issue