MediaWiki  master
BlockRestrictionStoreFactory.php
Go to the documentation of this file.
1 <?php
21 namespace MediaWiki\Block;
22 
25 
33  private $loadBalancerFactory;
34 
36  private $storeCache = [];
37 
41  public function __construct( LBFactory $loadBalancerFactory ) {
42  $this->loadBalancerFactory = $loadBalancerFactory;
43  }
44 
49  public function getBlockRestrictionStore( $wikiId = WikiAwareEntity::LOCAL ): BlockRestrictionStore {
50  if ( is_string( $wikiId ) && $this->loadBalancerFactory->getLocalDomainID() === $wikiId ) {
51  $wikiId = WikiAwareEntity::LOCAL;
52  }
53 
54  $storeCacheKey = $wikiId === WikiAwareEntity::LOCAL ? 'LOCAL' : 'crosswikistore-' . $wikiId;
55  if ( !isset( $this->storeCache[$storeCacheKey] ) ) {
56  $this->storeCache[$storeCacheKey] = new BlockRestrictionStore(
57  $this->loadBalancerFactory->getMainLB( $wikiId ),
58  $wikiId
59  );
60  }
61  return $this->storeCache[$storeCacheKey];
62  }
63 }
if(!defined('MW_SETUP_CALLBACK'))
The persistent session ID (if any) loaded at startup.
Definition: WebStart.php:82
Marker interface for entities aware of the wiki they belong to.