mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
Merge "Don't publish LogEntries without ID"
This commit is contained in:
commit
8ac0dda62d
|
@ -1458,7 +1458,7 @@ class AbuseFilter {
|
|||
if ( self::filterHidden( $data['afl_filter'] ) && !$wgAbuseFilterNotificationsPrivate ) {
|
||||
continue;
|
||||
}
|
||||
$entry->publish( 0, $wgAbuseFilterNotifications );
|
||||
self::publishEntry( $dbw, $entry, $wgAbuseFilterNotifications );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1513,6 +1513,31 @@ class AbuseFilter {
|
|||
self::checkEmergencyDisable( $group, $logged_local_filters );
|
||||
}
|
||||
|
||||
/**
|
||||
* Like LogEntry::publish, but doesn't require an ID (which we don't have) and skips the
|
||||
* tagging part
|
||||
*
|
||||
* @param IDatabase $dbw To cancel the callback if the log insertion fails
|
||||
* @param ManualLogEntry $entry
|
||||
* @param string $to One of 'udp', 'rc' and 'rcandudp'
|
||||
*/
|
||||
private static function publishEntry( IDatabase $dbw, ManualLogEntry $entry, $to ) {
|
||||
DeferredUpdates::addCallableUpdate(
|
||||
function () use ( $entry, $to ) {
|
||||
$rc = $entry->getRecentChange();
|
||||
|
||||
if ( $to === 'rc' || $to === 'rcandudp' ) {
|
||||
$rc->save( $rc::SEND_NONE );
|
||||
}
|
||||
if ( $to === 'udp' || $to === 'rcandudp' ) {
|
||||
$rc->notifyRCFeeds();
|
||||
}
|
||||
},
|
||||
DeferredUpdates::POSTSEND,
|
||||
$dbw
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a var dump to External Storage or the text table
|
||||
* Some of this code is stolen from Revision::insertOn and friends
|
||||
|
|
Loading…
Reference in a new issue