Addshore has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/400602 )
Change subject: Revert "[MCR] Add optional $title param to Revision byId methods" ...................................................................... Revert "[MCR] Add optional $title param to Revision byId methods" This reverts commit 7bfb4f195121008471974490ae24a86f2a450951. and 56b7ba03a286c0997752fb61b14662347ea0e9de This is no longer needed as the underlying issue has been fixed in commit 4de36baa63afc23398f5d1747f08fc47309c314c I15e4663902e2cbfe15b0da2e46449330e313bd0d Bug: T183505 Change-Id: I194a558625d15fd4f7929e363557847f8bebde4f --- M includes/Revision.php M includes/Storage/RevisionStore.php 2 files changed, 5 insertions(+), 49 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/02/400602/1 diff --git a/includes/Revision.php b/includes/Revision.php index 8f36e88..9a29386 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -94,54 +94,11 @@ * * @param int $id * @param int $flags (optional) - * @param Title $title (optional) If known you can pass the Title in here. - * Passing no Title may result in another DB query if there are recent writes. * @return Revision|null */ - public static function newFromId( $id, $flags = 0, Title $title = null ) { - /** - * MCR RevisionStore Compat - * - * If the title is not passed in as a param (already known) then select it here. - * - * Do the selection with MASTER if $flags includes READ_LATEST or recent changes - * have happened on our load balancer. - * - * If we select the title here and pass it down it will results in fewer queries - * further down the stack. - */ - if ( !$title ) { - if ( - $flags & self::READ_LATEST || - wfGetLB()->hasOrMadeRecentMasterChanges() - ) { - $dbr = wfGetDB( DB_MASTER ); - } else { - $dbr = wfGetDB( DB_REPLICA ); - } - $row = $dbr->selectRow( - [ 'revision', 'page' ], - [ - 'page_namespace', - 'page_title', - 'page_id', - 'page_latest', - 'page_is_redirect', - 'page_len', - ], - [ 'rev_id' => $id ], - __METHOD__, - [], - [ 'page' => [ 'JOIN', 'page_id=rev_page' ] ] - ); - if ( $row ) { - $title = Title::newFromRow( $row ); - } - wfGetLB()->reuseConnection( $dbr ); - } - - $rec = self::getRevisionStore()->getRevisionById( $id, $flags, $title ); - return $rec === null ? null : new Revision( $rec, $flags, $title ); + public static function newFromId( $id, $flags = 0 ) { + $rec = self::getRevisionStore()->getRevisionById( $id, $flags ); + return $rec === null ? null : new Revision( $rec, $flags ); } /** diff --git a/includes/Storage/RevisionStore.php b/includes/Storage/RevisionStore.php index e139faf..b571294 100644 --- a/includes/Storage/RevisionStore.php +++ b/includes/Storage/RevisionStore.php @@ -848,11 +848,10 @@ * * @param int $id * @param int $flags (optional) - * @param Title $title (optional) * @return RevisionRecord|null */ - public function getRevisionById( $id, $flags = 0, Title $title = null ) { - return $this->newRevisionFromConds( [ 'rev_id' => intval( $id ) ], $flags, $title ); + public function getRevisionById( $id, $flags = 0 ) { + return $this->newRevisionFromConds( [ 'rev_id' => intval( $id ) ], $flags ); } /** -- To view, visit https://gerrit.wikimedia.org/r/400602 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I194a558625d15fd4f7929e363557847f8bebde4f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Addshore <addshorew...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits