mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 14:13:54 +00:00
Strengthen the check for null edits
Even if the Content objects are different, the normalized text contents may be identical. Also, stop misattributing null edits by adding the last revision of the page as afl_rev_id. Bug: T240115 Change-Id: I3fb7b36ab38ca1544889a4c233b8ffdfc6c80936
This commit is contained in:
parent
f443eb8533
commit
6be070e5a2
|
@ -163,14 +163,12 @@ class AbuseFilterHooks {
|
|||
$articleCacheKey = $title->getNamespace() . ':' . $title->getText();
|
||||
AFComputedVariable::$articleCache[$articleCacheKey] = $page;
|
||||
|
||||
// Don't trigger for null edits.
|
||||
if ( $oldContent ) {
|
||||
// Compare Content objects if available
|
||||
if ( $content->equals( $oldContent ) ) {
|
||||
return null;
|
||||
}
|
||||
} elseif ( strcmp( $oldAfText, $text ) === 0 ) {
|
||||
// Otherwise, compare strings
|
||||
// Don't trigger for null edits. Compare Content objects if available, but check the
|
||||
// stringified contents as well, e.g. for line endings normalization (T240115)
|
||||
if (
|
||||
( $oldContent && $content->equals( $oldContent ) ) ||
|
||||
strcmp( $oldAfText, $text ) === 0
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
|
@ -314,7 +312,9 @@ class AbuseFilterHooks {
|
|||
) {
|
||||
$curTitle = $wikiPage->getTitle()->getPrefixedText();
|
||||
if ( !isset( AbuseFilter::$logIds[ $curTitle ] ) ||
|
||||
$wikiPage !== self::$lastEditPage
|
||||
$wikiPage !== self::$lastEditPage ||
|
||||
// Null edit. Too bad that there's no other way to recognize them.
|
||||
$status->hasMessage( 'edit-no-change' )
|
||||
) {
|
||||
// This isn't the edit AbuseFilter::$logIds was set for
|
||||
AbuseFilter::$logIds = [];
|
||||
|
|
Loading…
Reference in a new issue