MediaWiki 1.42.1
BlockRestrictionStoreFactory.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Block;
22
25
33 private $loadBalancerFactory;
34
36 private $storeCache = [];
37
39 private $blockTargetMigrationStage;
40
45 public function __construct(
46 LBFactory $loadBalancerFactory,
47 $blockTargetMigrationStage
48 ) {
49 $this->loadBalancerFactory = $loadBalancerFactory;
50 $this->blockTargetMigrationStage = $blockTargetMigrationStage;
51 }
52
57 public function getBlockRestrictionStore( $wikiId = WikiAwareEntity::LOCAL ): BlockRestrictionStore {
58 if ( is_string( $wikiId ) && $this->loadBalancerFactory->getLocalDomainID() === $wikiId ) {
59 $wikiId = WikiAwareEntity::LOCAL;
60 }
61
62 $storeCacheKey = $wikiId === WikiAwareEntity::LOCAL ? 'LOCAL' : 'crosswikistore-' . $wikiId;
63 if ( !isset( $this->storeCache[$storeCacheKey] ) ) {
64 $this->storeCache[$storeCacheKey] = new BlockRestrictionStore(
65 $this->loadBalancerFactory,
66 $this->blockTargetMigrationStage,
67 $wikiId
68 );
69 }
70 return $this->storeCache[$storeCacheKey];
71 }
72}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:81
__construct(LBFactory $loadBalancerFactory, $blockTargetMigrationStage)
Marker interface for entities aware of the wiki they belong to.