MediaWiki master
BlockRestrictionStoreFactory.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Block;
22
25
32 private LBFactory $loadBalancerFactory;
33
35 private array $storeCache = [];
36
37 public function __construct( LBFactory $loadBalancerFactory ) {
38 $this->loadBalancerFactory = $loadBalancerFactory;
39 }
40
45 public function getBlockRestrictionStore( $wikiId = WikiAwareEntity::LOCAL ): BlockRestrictionStore {
46 if ( is_string( $wikiId ) && $this->loadBalancerFactory->getLocalDomainID() === $wikiId ) {
47 $wikiId = WikiAwareEntity::LOCAL;
48 }
49
50 $storeCacheKey = $wikiId === WikiAwareEntity::LOCAL ? 'LOCAL' : 'crosswikistore-' . $wikiId;
51 if ( !isset( $this->storeCache[$storeCacheKey] ) ) {
52 $this->storeCache[$storeCacheKey] = new BlockRestrictionStore(
53 $this->loadBalancerFactory,
54 $wikiId
55 );
56 }
57 return $this->storeCache[$storeCacheKey];
58 }
59}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:81
Marker interface for entities aware of the wiki they belong to.