Proper casing for getDBkey()
[lhc/web/wiklou.git] / includes / filerepo / ForeignDBRepo.php
1 <?php
2
3 /**
4 * A foreign repository with an accessible MediaWiki database
5 * @ingroup FileRepo
6 */
7 class ForeignDBRepo extends LocalRepo {
8 # Settings
9 var $dbType, $dbServer, $dbUser, $dbPassword, $dbName, $dbFlags,
10 $tablePrefix, $hasSharedCache;
11
12 # Other stuff
13 var $dbConn;
14 var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' );
15 var $fileFromRowFactory = array( 'ForeignDBFile', 'newFromRow' );
16
17 function __construct( $info ) {
18 parent::__construct( $info );
19 $this->dbType = $info['dbType'];
20 $this->dbServer = $info['dbServer'];
21 $this->dbUser = $info['dbUser'];
22 $this->dbPassword = $info['dbPassword'];
23 $this->dbName = $info['dbName'];
24 $this->dbFlags = $info['dbFlags'];
25 $this->tablePrefix = $info['tablePrefix'];
26 $this->hasSharedCache = $info['hasSharedCache'];
27 }
28
29 function getMasterDB() {
30 if ( !isset( $this->dbConn ) ) {
31 $class = 'Database' . ucfirst( $this->dbType );
32 $this->dbConn = new $class( $this->dbServer, $this->dbUser,
33 $this->dbPassword, $this->dbName, false, $this->dbFlags,
34 $this->tablePrefix );
35 }
36 return $this->dbConn;
37 }
38
39 function getSlaveDB() {
40 return $this->getMasterDB();
41 }
42
43 function hasSharedCache() {
44 return $this->hasSharedCache;
45 }
46
47 function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
48 throw new MWException( get_class($this) . ': write operations are not supported' );
49 }
50 function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
51 throw new MWException( get_class($this) . ': write operations are not supported' );
52 }
53 function deleteBatch( $fileMap ) {
54 throw new MWException( get_class($this) . ': write operations are not supported' );
55 }
56 }