ForeignDBViaLBRepo.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * A foreign repository with a MediaWiki database accessible via the configured LBFactory
  4. * @ingroup FileRepo
  5. */
  6. class ForeignDBViaLBRepo extends LocalRepo {
  7. var $wiki, $dbName, $tablePrefix;
  8. var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' );
  9. var $fileFromRowFactory = array( 'ForeignDBFile', 'newFromRow' );
  10. function __construct( $info ) {
  11. parent::__construct( $info );
  12. $this->wiki = $info['wiki'];
  13. list( $this->dbName, $this->tablePrefix ) = wfSplitWikiID( $this->wiki );
  14. $this->hasSharedCache = $info['hasSharedCache'];
  15. }
  16. function getMasterDB() {
  17. return wfGetDB( DB_MASTER, array(), $this->wiki );
  18. }
  19. function getSlaveDB() {
  20. return wfGetDB( DB_SLAVE, array(), $this->wiki );
  21. }
  22. function hasSharedCache() {
  23. return $this->hasSharedCache;
  24. }
  25. function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
  26. throw new MWException( get_class($this) . ': write operations are not supported' );
  27. }
  28. function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
  29. throw new MWException( get_class($this) . ': write operations are not supported' );
  30. }
  31. function deleteBatch( $fileMap ) {
  32. throw new MWException( get_class($this) . ': write operations are not supported' );
  33. }
  34. }