Added sanity check to WikiPage to avoid duplicate edits.
authorAaron <aschulz@wikimedia.org>
Fri, 22 Jun 2012 17:47:54 +0000 (10:47 -0700)
committerAaron <aschulz@wikimedia.org>
Fri, 22 Jun 2012 17:47:54 +0000 (10:47 -0700)
Change-Id: I9f5e38d701f60bed582290a7019b559d8415e348

includes/WikiPage.php

index c203e4f..76a9828 100644 (file)
@@ -1523,6 +1523,9 @@ class WikiPage extends Page {
                                'user_text'  => $user->getName(),
                                'timestamp'  => $now
                        ) );
+                       # Bug 37225: use accessor to get the text as Revision may trim it.
+                       # After trimming, the text may be a duplicate of the current text.
+                       $text = $revision->getText(); // sanity; EditPage should trim already
 
                        $changed = ( strcmp( $text, $oldtext ) != 0 );
 
@@ -1620,6 +1623,9 @@ class WikiPage extends Page {
                        ) );
                        $revisionId = $revision->insertOn( $dbw );
 
+                       # Bug 37225: use accessor to get the text as Revision may trim it
+                       $text = $revision->getText(); // sanity; EditPage should trim already
+
                        # Update the page record with revision data
                        $this->updateRevisionOn( $dbw, $revision, 0 );