MediaWiki
REL1_19
|
00001 <?php 00014 class ForeignDBViaLBRepo extends LocalRepo { 00015 var $wiki, $dbName, $tablePrefix; 00016 var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' ); 00017 var $fileFromRowFactory = array( 'ForeignDBFile', 'newFromRow' ); 00018 00019 function __construct( $info ) { 00020 parent::__construct( $info ); 00021 $this->wiki = $info['wiki']; 00022 list( $this->dbName, $this->tablePrefix ) = wfSplitWikiID( $this->wiki ); 00023 $this->hasSharedCache = $info['hasSharedCache']; 00024 } 00025 00026 function getMasterDB() { 00027 return wfGetDB( DB_MASTER, array(), $this->wiki ); 00028 } 00029 00030 function getSlaveDB() { 00031 return wfGetDB( DB_SLAVE, array(), $this->wiki ); 00032 } 00033 00034 function hasSharedCache() { 00035 return $this->hasSharedCache; 00036 } 00037 00043 function getSharedCacheKey( /*...*/ ) { 00044 if ( $this->hasSharedCache() ) { 00045 $args = func_get_args(); 00046 array_unshift( $args, $this->wiki ); 00047 return implode( ':', $args ); 00048 } else { 00049 return false; 00050 } 00051 } 00052 00053 function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) { 00054 throw new MWException( get_class($this) . ': write operations are not supported' ); 00055 } 00056 function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) { 00057 throw new MWException( get_class($this) . ': write operations are not supported' ); 00058 } 00059 function deleteBatch( $fileMap ) { 00060 throw new MWException( get_class($this) . ': write operations are not supported' ); 00061 } 00062 }