/**
* @since 1.31
*
- * @param bool|string $wikiId The ID of the target wiki database. Use false for the local wiki.
+ * @param bool|string $dbDomain The ID of the target wiki database. Use false for the local wiki.
*
* @return BlobStore
*/
- public function newBlobStore( $wikiId = false ) {
- return $this->newSqlBlobStore( $wikiId );
+ public function newBlobStore( $dbDomain = false ) {
+ return $this->newSqlBlobStore( $dbDomain );
}
/**
* @internal Please call newBlobStore and use the BlobStore interface.
*
- * @param bool|string $wikiId The ID of the target wiki database. Use false for the local wiki.
+ * @param bool|string $dbDomain The ID of the target wiki database. Use false for the local wiki.
*
* @return SqlBlobStore
*/
- public function newSqlBlobStore( $wikiId = false ) {
- $lb = $this->lbFactory->getMainLB( $wikiId );
+ public function newSqlBlobStore( $dbDomain = false ) {
+ $lb = $this->lbFactory->getMainLB( $dbDomain );
$store = new SqlBlobStore(
$lb,
$this->cache,
- $wikiId
+ $dbDomain
);
$store->setCompressBlobs( $this->options->get( 'CompressRevisions' ) );
/**
* @param ILoadBalancer $dbLoadBalancer A load balancer for acquiring database connections
* @param WANObjectCache $cache A cache manager for caching data. This can be the local
- * wiki's default instance even if $wikiId refers to a different wiki, since
+ * wiki's default instance even if $dbDomain refers to a different wiki, since
* makeGlobalKey() is used to constructed a key that allows cached names from
* the same database to be re-used between wikis. For example, enwiki and frwiki will
* use the same cache keys for names from the wikidatawiki database, regardless
/**
* @var bool|string Wiki ID
*/
- private $wikiId;
+ private $dbDomain;
/**
* @var int
/**
* @param ILoadBalancer $dbLoadBalancer A load balancer for acquiring database connections
* @param WANObjectCache $cache A cache manager for caching blobs. This can be the local
- * wiki's default instance even if $wikiId refers to a different wiki, since
+ * wiki's default instance even if $dbDomain refers to a different wiki, since
* makeGlobalKey() is used to constructed a key that allows cached blobs from the
* same database to be re-used between wikis. For example, enwiki and frwiki will
* use the same cache keys for blobs from the wikidatawiki database, regardless of
* the cache's default key space.
- * @param bool|string $wikiId The ID of the target wiki database. Use false for the local wiki.
+ * @param bool|string $dbDomain The ID of the target wiki database. Use false for the local wiki.
*/
public function __construct(
ILoadBalancer $dbLoadBalancer,
WANObjectCache $cache,
- $wikiId = false
+ $dbDomain = false
) {
$this->dbLoadBalancer = $dbLoadBalancer;
$this->cache = $cache;
- $this->wikiId = $wikiId;
+ $this->dbDomain = $dbDomain;
}
/**
*/
private function getDBConnection( $index ) {
$lb = $this->getDBLoadBalancer();
- return $lb->getConnection( $index, [], $this->wikiId );
+ return $lb->getConnection( $index, [], $this->dbDomain );
}
/**
# Write to external storage if required
if ( $this->useExternalStore ) {
// Store and get the URL
- $data = ExternalStore::insertToDefault( $data );
+ $data = ExternalStore::insertToDefault( $data, [ 'wiki' => $this->dbDomain ] );
if ( $flags ) {
$flags .= ',';
}
return $this->cache->makeGlobalKey(
'BlobStore',
'address',
- $this->dbLoadBalancer->resolveDomainID( $this->wikiId ),
+ $this->dbLoadBalancer->resolveDomainID( $this->dbDomain ),
$blobAddress
);
}
$this->getCacheTTL(),
function () use ( $url, $flags ) {
// Ignore $setOpts; blobs are immutable and negatives are not cached
- $blob = ExternalStore::fetchFromURL( $url, [ 'wiki' => $this->wikiId ] );
+ $blob = ExternalStore::fetchFromURL( $url, [ 'wiki' => $this->dbDomain ] );
return $blob === false ? false : $this->decompressData( $blob, $flags );
},
[ 'pcGroup' => self::TEXT_CACHE_GROUP, 'pcTTL' => WANObjectCache::TTL_PROC_LONG ]
);
} else {
- $blob = ExternalStore::fetchFromURL( $url, [ 'wiki' => $this->wikiId ] );
+ $blob = ExternalStore::fetchFromURL( $url, [ 'wiki' => $this->dbDomain ] );
return $blob === false ? false : $this->decompressData( $blob, $flags );
}
} else {
*/
class BlobStoreFactoryTest extends MediaWikiTestCase {
- public function provideWikiIds() {
+ public function provideDbDomains() {
yield [ false ];
yield [ 'someWiki' ];
}
/**
- * @dataProvider provideWikiIds
+ * @dataProvider provideDbDomains
*/
- public function testNewBlobStore( $wikiId ) {
+ public function testNewBlobStore( $dbDomain ) {
$factory = MediaWikiServices::getInstance()->getBlobStoreFactory();
- $store = $factory->newBlobStore( $wikiId );
+ $store = $factory->newBlobStore( $dbDomain );
$this->assertInstanceOf( BlobStore::class, $store );
// This only works as we currently know this is a SqlBlobStore object
$wrapper = TestingAccessWrapper::newFromObject( $store );
- $this->assertEquals( $wikiId, $wrapper->wikiId );
+ $this->assertEquals( $dbDomain, $wrapper->dbDomain );
}
/**
- * @dataProvider provideWikiIds
+ * @dataProvider provideDbDomains
*/
- public function testNewSqlBlobStore( $wikiId ) {
+ public function testNewSqlBlobStore( $dbDomain ) {
$factory = MediaWikiServices::getInstance()->getBlobStoreFactory();
- $store = $factory->newSqlBlobStore( $wikiId );
+ $store = $factory->newSqlBlobStore( $dbDomain );
$this->assertInstanceOf( SqlBlobStore::class, $store );
$wrapper = TestingAccessWrapper::newFromObject( $store );
- $this->assertEquals( $wikiId, $wrapper->wikiId );
+ $this->assertEquals( $dbDomain, $wrapper->dbDomain );
}
}