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