assertRequiredOptions( self::CONSTRUCTOR_OPTIONS ); $this->options = $options; $this->logger = $logger; $this->actorStoreFactory = $actorStoreFactory; $this->blockRestrictionStoreFactory = $blockRestrictionStoreFactory; $this->commentStore = $commentStore; $this->hookContainer = $hookContainer; $this->loadBalancerFactory = $loadBalancerFactory; $this->configuredReadOnlyMode = $configuredReadOnlyMode; $this->userFactory = $userFactory; } /** * @param string|false $wikiId * @return DatabaseBlockStore */ public function getDatabaseBlockStore( $wikiId = DatabaseBlock::LOCAL ): DatabaseBlockStore { if ( is_string( $wikiId ) && $this->loadBalancerFactory->getLocalDomainID() === $wikiId ) { $wikiId = DatabaseBlock::LOCAL; } $storeCacheKey = $wikiId === DatabaseBlock::LOCAL ? 'LOCAL' : 'crosswikistore-' . $wikiId; if ( !isset( $this->storeCache[$storeCacheKey] ) ) { $loadBalancer = $this->loadBalancerFactory->getMainLB( $wikiId ); $this->storeCache[$storeCacheKey] = new DatabaseBlockStore( $this->options, $this->logger, $this->actorStoreFactory, $this->blockRestrictionStoreFactory->getBlockRestrictionStore( $wikiId ), $this->commentStore, $this->hookContainer, $loadBalancer, new ReadOnlyMode( $this->configuredReadOnlyMode, $loadBalancer ), $this->userFactory, $wikiId ); } return $this->storeCache[$storeCacheKey]; } }