wiki = $info['wiki']; $this->hasSharedCache = $info['hasSharedCache']; } public function getMasterDB() { return $this->getDBLoadBalancer()->getConnectionRef( DB_MASTER, [], $this->wiki ); } public function getReplicaDB() { return $this->getDBLoadBalancer()->getConnectionRef( DB_REPLICA, [], $this->wiki ); } /** * @return Closure */ protected function getDBFactory() { return function ( $index ) { return $this->getDBLoadBalancer()->getConnectionRef( $index, [], $this->wiki ); }; } /** * @return ILoadBalancer */ protected function getDBLoadBalancer() { $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); return $lbFactory->getMainLB( $this->wiki ); } private function hasSharedCache() { return $this->hasSharedCache; } public function getSharedCacheKey( ...$args ) { if ( $this->hasSharedCache() ) { return $this->wanCache->makeGlobalKey( $this->wiki, ...$args ); } else { return false; } } protected function assertWritableRepo() { throw new MWException( static::class . ': write operations are not supported.' ); } public function getInfo() { return FileRepo::getInfo(); } }