Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1429621
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
;
}
public
function
getFactory
(
string
|
false
$wikiId
=
WikiAwareEntity
::
LOCAL
):
BlockTargetFactory
{
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, May 16, 17:50 (8 h, 18 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
58/30/1f69f280a56e312adfb6194ee824
Default Alt Text
CrossWikiBlockTargetFactory.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment