*Add newFromArchiveName()
[lhc/web/wiklou.git] / includes / filerepo / LocalRepo.php
1 <?php
2 /**
3 * A repository that stores files in the local filesystem and registers them
4 * in the wiki's own database. This is the most commonly used repository class.
5 */
6 class LocalRepo extends FSRepo {
7 var $fileFactory = array( 'LocalFile', 'newFromTitle' );
8
9 function getSlaveDB() {
10 return wfGetDB( DB_SLAVE );
11 }
12
13 function getMasterDB() {
14 return wfGetDB( DB_MASTER );
15 }
16
17 function newFileFromRow( $row ) {
18 if ( isset( $row->img_name ) ) {
19 return LocalFile::newFromRow( $row, $this );
20 } elseif ( isset( $row->oi_name ) ) {
21 return OldLocalFile::newFromRow( $row, $this );
22 } else {
23 throw new MWException( __METHOD__.': invalid row' );
24 }
25 }
26
27 function newFromArchiveName( $title, $archiveName ) {
28 return OldLocalFile::newFromArchiveName( $title, $this, $archiveName );
29 }
30 }