From 37f52ed76293a5da4257ab18223c74025ed67273 Mon Sep 17 00:00:00 2001 From: addshore Date: Wed, 10 Jan 2018 16:17:40 +0000 Subject: [PATCH] [MCR] RevisionStore::getTitle, Fix flags passed to Title::newFromID This was passing $queryFlags directly into Title::newFromID which expects different flags. Instead we now set Title::GAID_FOR_UPDATE if $queryFlags will end up hitting the master. Change-Id: I9c6e275c22fe74a98e79c54049afa4915a7f565d --- includes/Storage/RevisionStore.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/Storage/RevisionStore.php b/includes/Storage/RevisionStore.php index e0ee06ad85..78e789e5f4 100644 --- a/includes/Storage/RevisionStore.php +++ b/includes/Storage/RevisionStore.php @@ -176,18 +176,18 @@ class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup throw new InvalidArgumentException( '$pageId and $revId cannot both be 0 or null' ); } + list( $dbMode, $dbOptions, , ) = DBAccessObjectUtils::getDBOptions( $queryFlags ); + $titleFlags = $dbMode == DB_MASTER ? Title::GAID_FOR_UPDATE : 0; $title = null; // Loading by ID is best, but Title::newFromID does not support that for foreign IDs. if ( $pageId !== null && $pageId > 0 && $this->wikiId === false ) { // TODO: better foreign title handling (introduce TitleFactory) - $title = Title::newFromID( $pageId, $queryFlags ); + $title = Title::newFromID( $pageId, $titleFlags ); } // rev_id is defined as NOT NULL, but this revision may not yet have been inserted. if ( !$title && $revId !== null && $revId > 0 ) { - list( $dbMode, $dbOptions, , ) = DBAccessObjectUtils::getDBOptions( $queryFlags ); - $dbr = $this->getDbConnectionRef( $dbMode ); // @todo: Title::getSelectFields(), or Title::getQueryInfo(), or something like that $row = $dbr->selectRow( -- 2.20.1