Fixed "last modified" date fudging on null edit
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 16 Sep 2015 22:13:48 +0000 (15:13 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 16 Sep 2015 22:13:48 +0000 (15:13 -0700)
* Avoid setting mTimestamp in doEditContent() until the edit was
  comitted. Null edits do not even try to add $revision to the DB,
  so do not set mTimestamp at all in that case.
* This avoids the problem where ParserCache used a bad getTimestamp()
  value to set the ParserOutput timestamp via setTimestamp(), which
  Article later uses as the "last modified" timestamp.

Bug: T112609
Change-Id: I79d7777c7f7470ff421ffeda80ac60dca07653fb

includes/page/WikiPage.php

index 657c4d0..b511d32 100644 (file)
@@ -1765,7 +1765,6 @@ class WikiPage implements Page, IDBAccessObject {
 
                $dbw = wfGetDB( DB_MASTER );
                $now = wfTimestampNow();
-               $this->mTimestamp = $now;
 
                if ( $flags & EDIT_UPDATE ) {
                        // Update article, but only if changed.
@@ -1844,6 +1843,7 @@ class WikiPage implements Page, IDBAccessObject {
                                $user->incEditCount();
 
                                $dbw->commit( __METHOD__ );
+                               $this->mTimestamp = $now;
                        } else {
                                // Bug 32948: revision ID must be set to page {{REVISIONID}} and
                                // related variables correctly
@@ -1938,6 +1938,7 @@ class WikiPage implements Page, IDBAccessObject {
                        $user->incEditCount();
 
                        $dbw->commit( __METHOD__ );
+                       $this->mTimestamp = $now;
 
                        // Update links, etc.
                        $this->doEditUpdates( $revision, $user, array( 'created' => true ) );