X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Ffilerepo%2FForeignDBViaLBRepo.php;h=7951fb1383e28767384a0b9e85874d3e450e18e6;hb=8f5ce91a043f74ea174c1f5feeb299f4cd5823eb;hp=e464f080b5b97fe008f3fe3855e9fccb4ab489fc;hpb=51ee20d4ba1a88ca910461cf0a0631e159f34518;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/ForeignDBViaLBRepo.php b/includes/filerepo/ForeignDBViaLBRepo.php index e464f080b5..7951fb1383 100644 --- a/includes/filerepo/ForeignDBViaLBRepo.php +++ b/includes/filerepo/ForeignDBViaLBRepo.php @@ -1,19 +1,39 @@ img_name ) ) - return ForeignDBFile::newFromRow( $row, $this ); - return parent::newFileFromRow( $row ); - } - + /** + * @param $info array|null + */ function __construct( $info ) { parent::__construct( $info ); $this->wiki = $info['wiki']; @@ -21,24 +41,41 @@ class ForeignDBViaLBRepo extends LocalRepo { $this->hasSharedCache = $info['hasSharedCache']; } + /** + * @return DatabaseBase + */ function getMasterDB() { return wfGetDB( DB_MASTER, array(), $this->wiki ); } + /** + * @return DatabaseBase + */ function getSlaveDB() { return wfGetDB( DB_SLAVE, array(), $this->wiki ); } + function hasSharedCache() { return $this->hasSharedCache; } - function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) { - throw new MWException( get_class($this) . ': write operations are not supported' ); + /** + * Get a key on the primary cache for this repository. + * Returns false if the repository's cache is not accessible at this site. + * The parameters are the parts of the key, as for wfMemcKey(). + * @return bool|string + */ + function getSharedCacheKey( /*...*/ ) { + if ( $this->hasSharedCache() ) { + $args = func_get_args(); + array_unshift( $args, $this->wiki ); + return implode( ':', $args ); + } else { + return false; + } } - function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) { - throw new MWException( get_class($this) . ': write operations are not supported' ); - } - function deleteBatch( $fileMap ) { - throw new MWException( get_class($this) . ': write operations are not supported' ); + + protected function assertWritableRepo() { + throw new MWException( get_class( $this ) . ': write operations are not supported.' ); } }