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 newFileFromRow( $row ) {
17 if ( isset( $row->img_name
) )
18 return ForeignDBFile
::newFromRow( $row, $this );
19 return parent
::newFileFromRow( $row );
22 function __construct( $info ) {
23 parent
::__construct( $info );
24 $this->dbType
= $info['dbType'];
25 $this->dbServer
= $info['dbServer'];
26 $this->dbUser
= $info['dbUser'];
27 $this->dbPassword
= $info['dbPassword'];
28 $this->dbName
= $info['dbName'];
29 $this->dbFlags
= $info['dbFlags'];
30 $this->tablePrefix
= $info['tablePrefix'];
31 $this->hasSharedCache
= $info['hasSharedCache'];
34 function getMasterDB() {
35 if ( !isset( $this->dbConn
) ) {
36 $class = 'Database' . ucfirst( $this->dbType
);
37 $this->dbConn
= new $class( $this->dbServer
, $this->dbUser
,
38 $this->dbPassword
, $this->dbName
, false, $this->dbFlags
,
44 function getSlaveDB() {
45 return $this->getMasterDB();
48 function hasSharedCache() {
49 return $this->hasSharedCache
;
52 function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
53 throw new MWException( get_class($this) . ': write operations are not supported' );
55 function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
56 throw new MWException( get_class($this) . ': write operations are not supported' );
58 function deleteBatch( $fileMap ) {
59 throw new MWException( get_class($this) . ': write operations are not supported' );