4 * A foreign repository with a MediaWiki database accessible via the configured LBFactory
7 class ForeignDBViaLBRepo
extends LocalRepo
{
8 var $wiki, $dbName, $tablePrefix;
9 var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' );
10 var $fileFromRowFactory = array( 'ForeignDBFile', 'newFromRow' );
12 function __construct( $info ) {
13 parent
::__construct( $info );
14 $this->wiki
= $info['wiki'];
15 list( $this->dbName
, $this->tablePrefix
) = wfSplitWikiID( $this->wiki
);
16 $this->hasSharedCache
= $info['hasSharedCache'];
19 function getMasterDB() {
20 return wfGetDB( DB_MASTER
, array(), $this->wiki
);
23 function getSlaveDB() {
24 return wfGetDB( DB_SLAVE
, array(), $this->wiki
);
26 function hasSharedCache() {
27 return $this->hasSharedCache
;
31 * Get a key on the primary cache for this repository.
32 * Returns false if the repository's cache is not accessible at this site.
33 * The parameters are the parts of the key, as for wfMemcKey().
35 function getSharedCacheKey( /*...*/ ) {
36 if ( $this->hasSharedCache() ) {
37 $args = func_get_args();
38 array_unshift( $args, $this->wiki
);
39 return implode( ':', $args );
45 function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
46 throw new MWException( get_class($this) . ': write operations are not supported' );
48 function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
49 throw new MWException( get_class($this) . ': write operations are not supported' );
51 function deleteBatch( $fileMap ) {
52 throw new MWException( get_class($this) . ': write operations are not supported' );