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' );
15 var $fileFromRowFactory = array( 'ForeignDBFile', 'newFromRow' );
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'];
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
,
39 function getSlaveDB() {
40 return $this->getMasterDB();
43 function hasSharedCache() {
44 return $this->hasSharedCache
;
47 function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
48 throw new MWException( get_class($this) . ': write operations are not supported' );
50 function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
51 throw new MWException( get_class($this) . ': write operations are not supported' );
53 function deleteBatch( $fileMap ) {
54 throw new MWException( get_class($this) . ': write operations are not supported' );