From: Aaron Schulz Date: Thu, 6 Oct 2016 00:10:43 +0000 (-0700) Subject: Use getConnectionRef() in ForeignDBViaLBRepo X-Git-Tag: 1.31.0-rc.0~5188^2 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=cc757af0e057a562fd5fb485627f8ff46494fc12;p=lhc%2Fweb%2Fwiklou.git Use getConnectionRef() in ForeignDBViaLBRepo This assures that reuseConnection() will be called. Change-Id: I6b9eb695d08045433ebb3204c0f72bcf63f21568 --- 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 ); }; }