Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5955240
CrossWikiBlockTargetFactory.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
CrossWikiBlockTargetFactory.php
View Options
<?php
namespace
MediaWiki\Block
;
use
MediaWiki\Config\ServiceOptions
;
use
MediaWiki\DAO\WikiAwareEntity
;
use
MediaWiki\User\ActorStoreFactory
;
use
MediaWiki\User\UserNameUtils
;
use
MediaWiki\WikiMap\WikiMap
;
/**
* Factory for BlockTargetFactory objects. This is needed for cross-wiki block
* operations, since BlockTargetFactory needs a wiki ID passed to its constructor.
*
* @since 1.44
*/
class
CrossWikiBlockTargetFactory
{
private
ActorStoreFactory
$actorStoreFactory
;
private
UserNameUtils
$userNameUtils
;
private
ServiceOptions
$options
;
/** @var BlockTargetFactory[] */
private
array
$storeCache
=
[];
/**
* @internal Only for use by ServiceWiring
*/
public
const
CONSTRUCTOR_OPTIONS
=
BlockTargetFactory
::
CONSTRUCTOR_OPTIONS
;
public
function
__construct
(
ServiceOptions
$options
,
ActorStoreFactory
$actorStoreFactory
,
UserNameUtils
$userNameUtils
)
{
$this
->
options
=
$options
;
$this
->
actorStoreFactory
=
$actorStoreFactory
;
$this
->
userNameUtils
=
$userNameUtils
;
}
/**
* @param string|false $wikiId
* @return BlockTargetFactory
*/
public
function
getFactory
(
$wikiId
=
WikiAwareEntity
::
LOCAL
)
{
if
(
is_string
(
$wikiId
)
&&
WikiMap
::
getCurrentWikiId
()
===
$wikiId
)
{
$wikiId
=
WikiAwareEntity
::
LOCAL
;
}
$storeCacheKey
=
$wikiId
===
WikiAwareEntity
::
LOCAL
?
'LOCAL'
:
'crosswikistore-'
.
$wikiId
;
if
(
!
isset
(
$this
->
storeCache
[
$storeCacheKey
]
)
)
{
$this
->
storeCache
[
$storeCacheKey
]
=
new
BlockTargetFactory
(
$this
->
options
,
$this
->
actorStoreFactory
->
getUserIdentityLookup
(
$wikiId
),
$this
->
userNameUtils
,
$wikiId
);
}
return
$this
->
storeCache
[
$storeCacheKey
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 03:33 (3 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c6/5e/3f4d277ef1e7b35e85e769e7a00b
Default Alt Text
CrossWikiBlockTargetFactory.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment