diff --git a/AbuseFilter.hooks.php b/AbuseFilter.hooks.php index 02f7c236b..cdb47438e 100644 --- a/AbuseFilter.hooks.php +++ b/AbuseFilter.hooks.php @@ -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' )