]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - includes/filerepo/ForeignDBViaLBRepo.php
MediaWiki 1.14.0
[autoinstallsdev/mediawiki.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         var $fileFromRowFactory = array( 'ForeignDBFile', 'newFromRow' );
11
12         function __construct( $info ) {
13                 parent::__construct( $info );
14                 $this->wiki = $info['wiki'];
15                 list( $this->dbName, $this->tablePrefix ) = wfSplitWikiID( $this->wiki );
16                 $this->hasSharedCache = $info['hasSharedCache'];
17         }
18
19         function getMasterDB() {
20                 return wfGetDB( DB_MASTER, array(), $this->wiki );
21         }
22
23         function getSlaveDB() {
24                 return wfGetDB( DB_SLAVE, array(), $this->wiki );
25         }
26         function hasSharedCache() {
27                 return $this->hasSharedCache;
28         }
29
30         function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
31                 throw new MWException( get_class($this) . ': write operations are not supported' );
32         }
33         function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
34                 throw new MWException( get_class($this) . ': write operations are not supported' );
35         }
36         function deleteBatch( $fileMap ) {
37                 throw new MWException( get_class($this) . ': write operations are not supported' );
38         }
39 }