4 * A foreign repository with an accessible MediaWiki database
7 class ForeignDBRepo
extends LocalRepo
{
9 var $dbType, $dbServer, $dbUser, $dbPassword, $dbName, $dbFlags,
10 $tablePrefix, $hasSharedCache;
14 var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' );
16 function __construct( $info ) {
17 parent
::__construct( $info );
18 $this->dbType
= $info['dbType'];
19 $this->dbServer
= $info['dbServer'];
20 $this->dbUser
= $info['dbUser'];
21 $this->dbPassword
= $info['dbPassword'];
22 $this->dbName
= $info['dbName'];
23 $this->dbFlags
= $info['dbFlags'];
24 $this->tablePrefix
= $info['tablePrefix'];
25 $this->hasSharedCache
= $info['hasSharedCache'];
28 function getMasterDB() {
29 if ( !isset( $this->dbConn
) ) {
30 $class = 'Database' . ucfirst( $this->dbType
);
31 $this->dbConn
= new $class( $this->dbServer
, $this->dbUser
,
32 $this->dbPassword
, $this->dbName
, false, $this->dbFlags
,
38 function getSlaveDB() {
39 return $this->getMasterDB();
42 function hasSharedCache() {
43 return $this->hasSharedCache
;
46 function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
47 throw new MWException( get_class($this) . ': write operations are not supported' );
49 function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
50 throw new MWException( get_class($this) . ': write operations are not supported' );
52 function deleteBatch( $fileMap ) {
53 throw new MWException( get_class($this) . ': write operations are not supported' );