Page MenuHomeWickedGov Phorge

TranslationUnitStoreFactory.php
No OneTemporary

Size
994 B
Referenced Files
None
Subscribers
None

TranslationUnitStoreFactory.php

<?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

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)

Event Timeline