ee9d11673d9c8d486a7e167a5e23f566e7930ac9
[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 * @ingroup FileRepo
6 */
7 class ForeignDBViaLBRepo extends LocalRepo {
8 var $wiki, $dbName, $tablePrefix;
9 var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' );
10
11 function __construct( $info ) {
12 parent::__construct( $info );
13 $this->wiki = $info['wiki'];
14 list( $this->dbName, $this->tablePrefix ) = wfSplitWikiID( $this->wiki );
15 $this->hasSharedCache = $info['hasSharedCache'];
16 }
17
18 function getMasterDB() {
19 return wfGetDB( DB_MASTER, array(), $this->wiki );
20 }
21
22 function getSlaveDB() {
23 return wfGetDB( DB_SLAVE, array(), $this->wiki );
24 }
25 function hasSharedCache() {
26 return $this->hasSharedCache;
27 }
28
29 function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
30 throw new MWException( get_class($this) . ': write operations are not supported' );
31 }
32 function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
33 throw new MWException( get_class($this) . ': write operations are not supported' );
34 }
35 function deleteBatch( $fileMap ) {
36 throw new MWException( get_class($this) . ': write operations are not supported' );
37 }
38 }