X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilerepo%2FForeignDBRepo.php;h=283576a29eedcd31fc9c61d8bd66d801f8fe3a61;hb=09cc5e1e42ad827eef8f8db7b16fbaa7ca238a9f;hp=6e9e6add48b6e4493570c26fd3f8c768f5d57d27;hpb=adbadb9ee62284d70d9e7763379ab3b4eb6bde6f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/ForeignDBRepo.php b/includes/filerepo/ForeignDBRepo.php index 6e9e6add48..283576a29e 100644 --- a/includes/filerepo/ForeignDBRepo.php +++ b/includes/filerepo/ForeignDBRepo.php @@ -72,33 +72,44 @@ class ForeignDBRepo extends LocalRepo { } /** - * @return DatabaseBase + * @return IDatabase */ function getMasterDB() { if ( !isset( $this->dbConn ) ) { - $this->dbConn = DatabaseBase::factory( $this->dbType, - array( - 'host' => $this->dbServer, - 'user' => $this->dbUser, - 'password' => $this->dbPassword, - 'dbname' => $this->dbName, - 'flags' => $this->dbFlags, - 'tablePrefix' => $this->tablePrefix, - 'foreign' => true, - ) - ); + $func = $this->getDBFactory(); + $this->dbConn = $func( DB_MASTER ); } return $this->dbConn; } /** - * @return DatabaseBase + * @return IDatabase */ function getSlaveDB() { return $this->getMasterDB(); } + /** + * @return Closure + */ + protected function getDBFactory() { + $type = $this->dbType; + $params = array( + 'host' => $this->dbServer, + 'user' => $this->dbUser, + 'password' => $this->dbPassword, + 'dbname' => $this->dbName, + 'flags' => $this->dbFlags, + 'tablePrefix' => $this->tablePrefix, + 'foreign' => true, + ); + + return function ( $index ) use ( $type, $params ) { + return DatabaseBase::factory( $type, $params ); + }; + } + /** * @return bool */