Jackmcbarn has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/159556

Change subject: Only skip apparent null-edits when the page exists
......................................................................

Only skip apparent null-edits when the page exists

Bug: 70675
Change-Id: I161bc61eb89702e273fef58932f8fb1c150257af
---
M AbuseFilter.hooks.php
1 file changed, 9 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter 
refs/changes/56/159556/1

diff --git a/AbuseFilter.hooks.php b/AbuseFilter.hooks.php
index 02f7c23..cdb4743 100644
--- a/AbuseFilter.hooks.php
+++ b/AbuseFilter.hooks.php
@@ -139,9 +139,7 @@
 
                $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,17 +159,17 @@
                        // 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(

-- 
To view, visit https://gerrit.wikimedia.org/r/159556
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I161bc61eb89702e273fef58932f8fb1c150257af
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: Jackmcbarn <jackmcb...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to