mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
Merge "Only skip apparent null-edits when the page exists"
This commit is contained in:
commit
24a0a2dd78
|
@ -139,9 +139,7 @@ class AbuseFilterHooks {
|
|||
|
||||
$user = $context->getUser();
|
||||
|
||||
// Check for null edits.
|
||||
$oldtext = '';
|
||||
$oldcontent = null;
|
||||
|
||||
if ( ( $title instanceof Title ) && $title->canExist() && $title->exists() ) {
|
||||
// Make sure we load the latest text saved in database (bug 31656)
|
||||
|
@ -161,19 +159,19 @@ class AbuseFilterHooks {
|
|||
// Cache article object so we can share a parse operation
|
||||
$articleCacheKey = $title->getNamespace() . ':' . $title->getText();
|
||||
AFComputedVariable::$articleCache[$articleCacheKey] = $page;
|
||||
|
||||
// Don't trigger for null edits.
|
||||
if ( $content && isset( $oldcontent ) && $content->equals( $oldcontent ) ) {
|
||||
// Compare Content objects if available
|
||||
return true;
|
||||
} elseif ( strcmp( $oldtext, $text ) == 0 ) {
|
||||
// Otherwise, compare strings
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
$page = null;
|
||||
}
|
||||
|
||||
// Don't trigger for null edits.
|
||||
if ( $content && $oldcontent && $oldcontent->equals( $content ) ) {
|
||||
// Compare Content objects if available
|
||||
return true;
|
||||
} else if ( strcmp( $oldtext, $text ) == 0 ) {
|
||||
// Otherwise, compare strings
|
||||
return true;
|
||||
}
|
||||
|
||||
$vars->addHolders(
|
||||
AbuseFilter::generateUserVars( $user ),
|
||||
AbuseFilter::generateTitleVars( $title , 'ARTICLE' )
|
||||
|
|
Loading…
Reference in a new issue