4 * A foreign repository with a remote MediaWiki with an API thingy
5 * Very hacky and inefficient
9 class ForeignDBRepo
extends LocalRepo
{
11 var $dbType, $dbServer, $dbUser, $dbPassword, $dbName, $dbFlags,
12 $tablePrefix, $hasSharedCache;
16 var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' );
18 function newFileFromRow( $row ) {
19 if ( isset( $row->img_name
) )
20 return ForeignDBFile
::newFromRow( $row, $this );
21 return parent
::newFileFromRow( $row );
24 function __construct( $info ) {
25 parent
::__construct( $info );
26 $this->dbType
= $info['dbType'];
27 $this->dbServer
= $info['dbServer'];
28 $this->dbUser
= $info['dbUser'];
29 $this->dbPassword
= $info['dbPassword'];
30 $this->dbName
= $info['dbName'];
31 $this->dbFlags
= $info['dbFlags'];
32 $this->tablePrefix
= $info['tablePrefix'];
33 $this->hasSharedCache
= $info['hasSharedCache'];
36 function getMasterDB() {
37 if ( !isset( $this->dbConn
) ) {
38 $class = 'Database' . ucfirst( $this->dbType
);
39 $this->dbConn
= new $class( $this->dbServer
, $this->dbUser
,
40 $this->dbPassword
, $this->dbName
, false, $this->dbFlags
,
46 function getSlaveDB() {
47 return $this->getMasterDB();
50 function hasSharedCache() {
51 return $this->hasSharedCache
;
54 function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
55 throw new MWException( get_class($this) . ': write operations are not supported' );
57 function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
58 throw new MWException( get_class($this) . ': write operations are not supported' );
60 function deleteBatch( $fileMap ) {
61 throw new MWException( get_class($this) . ': write operations are not supported' );