Hack around borkage with findFiles() on ForeignDBViaLBRepo by copying newFileFromRow...
[lhc/web/wiklou.git] / includes / filerepo / ForeignDBViaLBRepo.php
1 <?php
2
3 /**
4 * A foreign repository with a MediaWiki database accessible via the configured LBFactory
5 * @ingroup FileRepo
6 */
7 class ForeignDBViaLBRepo extends LocalRepo {
8 var $wiki, $dbName, $tablePrefix;
9 var $fileFactory = array( 'ForeignDBFile', 'newFromTitle' );
10
11 function newFileFromRow( $row ) {
12 if ( isset( $row->img_name ) )
13 return ForeignDBFile::newFromRow( $row, $this );
14 return parent::newFileFromRow( $row );
15 }
16
17 function __construct( $info ) {
18 parent::__construct( $info );
19 $this->wiki = $info['wiki'];
20 list( $this->dbName, $this->tablePrefix ) = wfSplitWikiID( $this->wiki );
21 $this->hasSharedCache = $info['hasSharedCache'];
22 }
23
24 function getMasterDB() {
25 return wfGetDB( DB_MASTER, array(), $this->wiki );
26 }
27
28 function getSlaveDB() {
29 return wfGetDB( DB_SLAVE, array(), $this->wiki );
30 }
31 function hasSharedCache() {
32 return $this->hasSharedCache;
33 }
34
35 function store( $srcPath, $dstZone, $dstRel, $flags = 0 ) {
36 throw new MWException( get_class($this) . ': write operations are not supported' );
37 }
38 function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) {
39 throw new MWException( get_class($this) . ': write operations are not supported' );
40 }
41 function deleteBatch( $fileMap ) {
42 throw new MWException( get_class($this) . ': write operations are not supported' );
43 }
44 }