MediaWiki master
BlockUtilsFactory.php
Go to the documentation of this file.
1<?php
2
22namespace MediaWiki\Block;
23
25
31 private CrossWikiBlockTargetFactory $crossWikiBlockTargetFactory;
32
34 private array $storeCache = [];
35
36 public function __construct(
37 CrossWikiBlockTargetFactory $crossWikiBlockTargetFactory
38 ) {
39 $this->crossWikiBlockTargetFactory = $crossWikiBlockTargetFactory;
40 }
41
46 public function getBlockUtils( $wikiId = Block::LOCAL ): BlockUtils {
47 if ( is_string( $wikiId ) && WikiMap::getCurrentWikiId() === $wikiId ) {
48 $wikiId = Block::LOCAL;
49 }
50
51 $storeCacheKey = $wikiId === Block::LOCAL ? 'LOCAL' : 'crosswikistore-' . $wikiId;
52 if ( !isset( $this->storeCache[$storeCacheKey] ) ) {
53 $this->storeCache[$storeCacheKey] = new BlockUtils(
54 $this->crossWikiBlockTargetFactory->getFactory( $wikiId )
55 );
56 }
57 return $this->storeCache[$storeCacheKey];
58 }
59}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:82
__construct(CrossWikiBlockTargetFactory $crossWikiBlockTargetFactory)
Backend class for blocking utils.
Tools for dealing with other locally-hosted wikis.
Definition WikiMap.php:33