MediaWiki master
CrossWikiBlockTargetFactory.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Block;
4
10
18 private ActorStoreFactory $actorStoreFactory;
19 private UserNameUtils $userNameUtils;
20 private ServiceOptions $options;
21
23 private array $storeCache = [];
24
29
30 public function __construct(
31 ServiceOptions $options,
32 ActorStoreFactory $actorStoreFactory,
33 UserNameUtils $userNameUtils
34 ) {
35 $this->options = $options;
36 $this->actorStoreFactory = $actorStoreFactory;
37 $this->userNameUtils = $userNameUtils;
38 }
39
44 public function getFactory( $wikiId = WikiAwareEntity::LOCAL ) {
45 if ( is_string( $wikiId ) && WikiMap::getCurrentWikiId() === $wikiId ) {
46 $wikiId = WikiAwareEntity::LOCAL;
47 }
48
49 $storeCacheKey = $wikiId === WikiAwareEntity::LOCAL ? 'LOCAL' : 'crosswikistore-' . $wikiId;
50 if ( !isset( $this->storeCache[$storeCacheKey] ) ) {
51 $this->storeCache[$storeCacheKey] = new BlockTargetFactory(
52 $this->options,
53 $this->actorStoreFactory->getUserIdentityLookup( $wikiId ),
54 $this->userNameUtils,
55 $wikiId
56 );
57 }
58 return $this->storeCache[$storeCacheKey];
59 }
60}
Factory for BlockTarget objects.
__construct(ServiceOptions $options, ActorStoreFactory $actorStoreFactory, UserNameUtils $userNameUtils)
A class for passing options to services.
ActorStore factory for any wiki domain.
UserNameUtils service.
Tools for dealing with other locally-hosted wikis.
Definition WikiMap.php:33
Marker interface for entities aware of the wiki they belong to.