X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Ffilerepo%2FForeignDBRepo.php;h=dfdb37537ca52f75e001592d065015d0df9ef397;hp=92f017f6c6019a09e65f1e7ee6cb12062d43cdf2;hb=59ebff658ce912c1b0e7ef8d8f9bfec5a4e17b39;hpb=76dc1986514cc2da47a0d3872bac8cdcb4ef80e5 diff --git a/includes/filerepo/ForeignDBRepo.php b/includes/filerepo/ForeignDBRepo.php index 92f017f6c6..dfdb37537c 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; @@ -99,6 +90,25 @@ class ForeignDBRepo extends LocalRepo { return $this->getMasterDB(); } + /** + * @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 */ @@ -126,4 +136,14 @@ class ForeignDBRepo extends LocalRepo { protected function assertWritableRepo() { throw new MWException( get_class( $this ) . ': write operations are not supported.' ); } + + /** + * Return information about the repository. + * + * @return array + * @since 1.22 + */ + function getInfo() { + return FileRepo::getInfo(); + } }