00001 <?php
00002
00007 class ForeignDBViaLBRepo extends LocalRepo {
00008 var $wiki, $dbName, $tablePrefix;
00009 var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' );
00010 var $fileFromRowFactory = array( 'ForeignDBFile', 'newFromRow' );
00011
00012 function __construct( $info ) {
00013 parent::__construct( $info );
00014 $this->wiki = $info['wiki'];
00015 list( $this->dbName, $this->tablePrefix ) = wfSplitWikiID( $this->wiki );
00016 $this->hasSharedCache = $info['hasSharedCache'];
00017 }
00018
00019 function getMasterDB() {
00020 return wfGetDB( DB_MASTER, array(), $this->wiki );
00021 }
00022
00023 function getSlaveDB() {
00024 return wfGetDB( DB_SLAVE, array(), $this->wiki );
00025 }
00026 function hasSharedCache() {
00027 return $this->hasSharedCache;
00028 }
00029
00035 function getSharedCacheKey( ) {
00036 if ( $this->hasSharedCache() ) {
00037 $args = func_get_args();
00038 array_unshift( $args, $this->wiki );
00039 return implode( ':', $args );
00040 } else {
00041 return false;
00042 }
00043 }
00044
00045 function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
00046 throw new MWException( get_class($this) . ': write operations are not supported' );
00047 }
00048 function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
00049 throw new MWException( get_class($this) . ': write operations are not supported' );
00050 }
00051 function deleteBatch( $fileMap ) {
00052 throw new MWException( get_class($this) . ': write operations are not supported' );
00053 }
00054 }