diff options
Diffstat (limited to 'includes/filerepo/ForeignDBRepo.php')
-rw-r--r-- | includes/filerepo/ForeignDBRepo.php | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/includes/filerepo/ForeignDBRepo.php b/includes/filerepo/ForeignDBRepo.php index 6e9e6add..dfdb3753 100644 --- a/includes/filerepo/ForeignDBRepo.php +++ b/includes/filerepo/ForeignDBRepo.php @@ -76,17 +76,8 @@ class ForeignDBRepo extends LocalRepo { */ 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; @@ -100,6 +91,25 @@ class ForeignDBRepo extends LocalRepo { } /** + * @return Closure + */ + protected function getDBFactory() { + return function( $index ) { + return 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, + ) + ); + }; + } + + /** * @return bool */ function hasSharedCache() { |