wiki = $info['wiki']; list( $this->dbName, $this->tablePrefix ) = wfSplitWikiID( $this->wiki ); $this->hasSharedCache = $info['hasSharedCache']; } /** * @return IDatabase */ function getMasterDB() { return wfGetLB( $this->wiki )->getConnectionRef( DB_MASTER, [], $this->wiki ); } /** * @return IDatabase */ function getReplicaDB() { return wfGetLB( $this->wiki )->getConnectionRef( DB_REPLICA, [], $this->wiki ); } /** * @return Closure */ protected function getDBFactory() { return function ( $index ) { return wfGetLB( $this->wiki )->getConnectionRef( $index, [], $this->wiki ); }; } function hasSharedCache() { return $this->hasSharedCache; } /** * Get a key on the primary cache for this repository. * Returns false if the repository's cache is not accessible at this site. * The parameters are the parts of the key, as for wfMemcKey(). * @return bool|string */ function getSharedCacheKey( /*...*/ ) { if ( $this->hasSharedCache() ) { $args = func_get_args(); array_unshift( $args, $this->wiki ); return implode( ':', $args ); } else { return false; } } protected function assertWritableRepo() { throw new MWException( static::class . ': write operations are not supported.' ); } public function getInfo() { return FileRepo::getInfo(); } }