From: Matthew Flaschen Date: Thu, 6 Oct 2016 04:31:30 +0000 (-0400) Subject: Revision->insertOn: Set READ_LATEST flag X-Git-Tag: 1.31.0-rc.0~5190^2 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=1588b1837665d9b2d629b4c141e7b6bb0b92e6ff;p=lhc%2Fweb%2Fwiklou.git Revision->insertOn: Set READ_LATEST flag Inserting new revisions requires master by definition. Without this, there can be problems when creating multiple revisions in a transaction (i.e. a null revision pointed to a text_id borrowed from a just-created revision). Bug: T138310 Change-Id: I10773612f04b6525f9c8bc27a96bcb8a77831816 --- diff --git a/includes/Revision.php b/includes/Revision.php index ddbe64617b..208652fd22 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -1395,6 +1395,11 @@ class Revision implements IDBAccessObject { public function insertOn( $dbw ) { global $wgDefaultExternalStore, $wgContentHandlerUseDB; + // We're inserting a new revision, so we have to use master anyway. + // If it's a null revision, it may have references to rows that + // are not in the replica yet (the text row). + $this->mQueryFlags |= self::READ_LATEST; + // Not allowed to have rev_page equal to 0, false, etc. if ( !$this->mPage ) { $title = $this->getTitle();