Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F581517
ForeignDBViaLBRepo.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
ForeignDBViaLBRepo.php
View Options
<?php
/**
* @license GPL-2.0-or-later
* @file
*/
namespace
MediaWiki\FileRepo
;
use
Closure
;
use
LogicException
;
use
MediaWiki\FileRepo\File\ForeignDBFile
;
use
MediaWiki\MediaWikiServices
;
use
Wikimedia\Rdbms\IConnectionProvider
;
/**
* A foreign repository with a MediaWiki database accessible via the configured LBFactory.
*
* @ingroup FileRepo
*/
class
ForeignDBViaLBRepo
extends
LocalRepo
implements
IForeignRepoWithDB
{
/** @var array */
protected
$fileFactory
=
[
ForeignDBFile
::
class
,
'newFromTitle'
];
/** @var array */
protected
$fileFromRowFactory
=
[
ForeignDBFile
::
class
,
'newFromRow'
];
/**
* @param array|null $info
*/
public
function
__construct
(
$info
)
{
parent
::
__construct
(
$info
);
'@phan-var array $info'
;
$this
->
dbDomain
=
$info
[
'wiki'
];
$this
->
hasAccessibleSharedCache
=
$info
[
'hasSharedCache'
];
}
/** @inheritDoc */
public
function
getPrimaryDB
()
{
return
$this
->
getDbProvider
()->
getPrimaryDatabase
(
$this
->
dbDomain
);
}
/** @inheritDoc */
public
function
getReplicaDB
()
{
return
$this
->
getDbProvider
()->
getReplicaDatabase
(
$this
->
dbDomain
);
}
/**
* @return Closure
*/
protected
function
getDBFactory
()
{
return
function
(
$index
)
{
if
(
$index
==
DB_PRIMARY
)
{
return
$this
->
getDbProvider
()->
getPrimaryDatabase
(
$this
->
dbDomain
);
}
else
{
return
$this
->
getDbProvider
()->
getReplicaDatabase
(
$this
->
dbDomain
);
}
};
}
protected
function
getDbProvider
():
IConnectionProvider
{
return
MediaWikiServices
::
getInstance
()->
getConnectionProvider
();
}
protected
function
assertWritableRepo
():
never
{
throw
new
LogicException
(
static
::
class
.
': write operations are not supported.'
);
}
/** @inheritDoc */
public
function
getInfo
()
{
return
FileRepo
::
getInfo
();
}
}
/** @deprecated class alias since 1.44 */
class_alias
(
ForeignDBViaLBRepo
::
class
,
'ForeignDBViaLBRepo'
);
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Mar 31, 10:39 (1 d, 10 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
49/8d/6348044e7c968582cd907ec21e5d
Default Alt Text
ForeignDBViaLBRepo.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment