Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5961421
TranslationUnitStoreFactory.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
994 B
Referenced Files
None
Subscribers
None
TranslationUnitStoreFactory.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
MediaWiki\Extension\Translate\PageTranslation
;
use
LogicException
;
use
MediaWiki\Page\PageIdentity
;
use
Wikimedia\Rdbms\ILoadBalancer
;
use
const
DB_PRIMARY
;
use
const
DB_REPLICA
;
/**
* @author Niklas Laxström
* @license GPL-2.0-or-later
* @since 2021.05
*/
class
TranslationUnitStoreFactory
{
private
ILoadBalancer
$lb
;
public
function
__construct
(
ILoadBalancer
$lb
)
{
$this
->
lb
=
$lb
;
}
public
function
getReader
(
PageIdentity
$page
):
TranslationUnitReader
{
$pageId
=
$page
->
getId
();
if
(
$pageId
===
0
)
{
throw
new
LogicException
(
'Page must exist'
);
}
return
new
TranslationUnitStore
(
$this
->
lb
->
getConnection
(
DB_REPLICA
),
$pageId
);
}
public
function
getWriter
(
PageIdentity
$page
):
TranslationUnitStore
{
$pageId
=
$page
->
getId
();
if
(
$pageId
===
0
)
{
throw
new
LogicException
(
'Page must exist'
);
}
return
new
TranslationUnitStore
(
$this
->
lb
->
getConnection
(
DB_PRIMARY
),
$pageId
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 08:05 (1 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
47/06/72434f5ee3110a335ebb489a37e0
Default Alt Text
TranslationUnitStoreFactory.php (994 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment