* Introduced LBFactory -- an abstract class for configuring database load balancers...
[lhc/web/wiklou.git] / includes / filerepo / ForeignDBViaLBRepo.php
1 <?php
2
3 /**
4 * A foreign repository with a MediaWiki database accessible via the configured LBFactory
5 */
6 class ForeignDBViaLBRepo extends LocalRepo {
7 var $wiki, $dbName, $tablePrefix;
8 var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' );
9
10 function __construct( $info ) {
11 parent::__construct( $info );
12 $this->wiki = $info['wiki'];
13 list( $this->dbName, $this->tablePrefix ) = wfSplitWikiID( $this->wiki );
14 $this->hasSharedCache = $info['hasSharedCache'];
15 }
16
17 function getMasterDB() {
18 return wfGetDB( DB_MASTER, array(), $this->wiki );
19 }
20
21 function getSlaveDB() {
22 return wfGetDB( DB_SLAVE, array(), $this->wiki );
23 }
24 function hasSharedCache() {
25 return $this->hasSharedCache;
26 }
27
28 function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
29 throw new MWException( get_class($this) . ': write operations are not supported' );
30 }
31 function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
32 throw new MWException( get_class($this) . ': write operations are not supported' );
33 }
34 function deleteBatch( $fileMap ) {
35 throw new MWException( get_class($this) . ': write operations are not supported' );
36 }
37 }