Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7456152
PoolCounterFactory.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
PoolCounterFactory.php
View Options
<?php
namespace
MediaWiki\PoolCounter
;
use
Psr\Log\LoggerInterface
;
/**
* @since 1.40
*/
class
PoolCounterFactory
{
private
?
PoolCounterConnectionManager
$manager
=
null
;
private
?
array
$typeConfigs
;
private
array
$clientConf
;
private
LoggerInterface
$logger
;
/**
* @internal For use by ServiceWiring
* @param array|null $typeConfigs See $wgPoolCounterConf
* @param array $clientConf See $wgPoolCountClientConf
* @param LoggerInterface $logger
*/
public
function
__construct
(
?
array
$typeConfigs
,
array
$clientConf
,
LoggerInterface
$logger
)
{
$this
->
typeConfigs
=
$typeConfigs
;
$this
->
clientConf
=
$clientConf
;
$this
->
logger
=
$logger
;
}
private
function
getClientManager
():
PoolCounterConnectionManager
{
$this
->
manager
??=
new
PoolCounterConnectionManager
(
$this
->
clientConf
);
return
$this
->
manager
;
}
/**
* Get a PoolCounter.
*
* @internal This should only be called from PoolCounterWork
* @param string $type The class of actions to limit concurrency for (task type)
* @param string $key
* @return PoolCounter
*/
public
function
create
(
string
$type
,
string
$key
):
PoolCounter
{
$conf
=
$this
->
typeConfigs
[
$type
]
??
null
;
if
(
$conf
===
null
)
{
return
new
PoolCounterNull
();
}
$class
=
$conf
[
'class'
]
??
null
;
if
(
$class
===
'PoolCounter_Client'
)
{
// Since 1.16: Introduce PoolCounter_Client in PoolCounter extension.
// Since 1.40: Move to core as symbolic name, discourage use of class name.
$class
=
PoolCounterClient
::
class
;
}
/** @var PoolCounter $poolCounter */
$poolCounter
=
new
$class
(
$conf
,
$type
,
$key
);
$poolCounter
->
setLogger
(
$this
->
logger
);
// Support subclass for back-compat with the extension
if
(
$poolCounter
instanceof
PoolCounterClient
)
{
$poolCounter
->
setManager
(
$this
->
getClientManager
()
);
}
return
$poolCounter
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Nov 23, 00:21 (2 d, 12 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
6d/a5/44e692cb57945cb7c1f43946ed09
Default Alt Text
PoolCounterFactory.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment