From cc757af0e057a562fd5fb485627f8ff46494fc12 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 5 Oct 2016 17:10:43 -0700 Subject: [PATCH] Use getConnectionRef() in ForeignDBViaLBRepo This assures that reuseConnection() will be called. Change-Id: I6b9eb695d08045433ebb3204c0f72bcf63f21568 --- includes/filerepo/ForeignDBViaLBRepo.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/filerepo/ForeignDBViaLBRepo.php b/includes/filerepo/ForeignDBViaLBRepo.php index 55df1af03b..129d55aa2a 100644 --- a/includes/filerepo/ForeignDBViaLBRepo.php +++ b/includes/filerepo/ForeignDBViaLBRepo.php @@ -59,23 +59,22 @@ class ForeignDBViaLBRepo extends LocalRepo { * @return IDatabase */ function getMasterDB() { - return wfGetDB( DB_MASTER, [], $this->wiki ); + return wfGetLB( $this->wiki )->getConnectionRef( DB_MASTER, [], $this->wiki ); } /** * @return IDatabase */ function getSlaveDB() { - return wfGetDB( DB_REPLICA, [], $this->wiki ); + return wfGetLB( $this->wiki )->getConnectionRef( DB_REPLICA, [], $this->wiki ); } /** * @return Closure */ protected function getDBFactory() { - $wiki = $this->wiki; - return function( $index ) use ( $wiki ) { - return wfGetDB( $index, [], $wiki ); + return function( $index ) { + return wfGetLB( $this->wiki )->getConnectionRef( $index, [], $this->wiki ); }; } -- 2.20.1