00001 <?php 00002 00007 class ForeignDBRepo extends LocalRepo { 00008 # Settings 00009 var $dbType, $dbServer, $dbUser, $dbPassword, $dbName, $dbFlags, 00010 $tablePrefix, $hasSharedCache; 00011 00012 # Other stuff 00013 var $dbConn; 00014 var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' ); 00015 var $fileFromRowFactory = array( 'ForeignDBFile', 'newFromRow' ); 00016 00017 function __construct( $info ) { 00018 parent::__construct( $info ); 00019 $this->dbType = $info['dbType']; 00020 $this->dbServer = $info['dbServer']; 00021 $this->dbUser = $info['dbUser']; 00022 $this->dbPassword = $info['dbPassword']; 00023 $this->dbName = $info['dbName']; 00024 $this->dbFlags = $info['dbFlags']; 00025 $this->tablePrefix = $info['tablePrefix']; 00026 $this->hasSharedCache = $info['hasSharedCache']; 00027 } 00028 00029 function getMasterDB() { 00030 if ( !isset( $this->dbConn ) ) { 00031 $class = 'Database' . ucfirst( $this->dbType ); 00032 $this->dbConn = new $class( $this->dbServer, $this->dbUser, 00033 $this->dbPassword, $this->dbName, false, $this->dbFlags, 00034 $this->tablePrefix ); 00035 } 00036 return $this->dbConn; 00037 } 00038 00039 function getSlaveDB() { 00040 return $this->getMasterDB(); 00041 } 00042 00043 function hasSharedCache() { 00044 return $this->hasSharedCache; 00045 } 00046 00047 function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) { 00048 throw new MWException( get_class($this) . ': write operations are not supported' ); 00049 } 00050 function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) { 00051 throw new MWException( get_class($this) . ': write operations are not supported' ); 00052 } 00053 function deleteBatch( $fileMap ) { 00054 throw new MWException( get_class($this) . ': write operations are not supported' ); 00055 } 00056 }