wfProfileOut() for new return added in c6396 (c4e407c)
[lhc/web/wiklou.git] / includes / filerepo / FSRepo.php
1 <?php
2 /**
3 * A repository for files accessible via the local filesystem.
4 *
5 * @file
6 * @ingroup FileRepo
7 */
8
9 /**
10 * A repository for files accessible via the local filesystem.
11 * Does not support database access or registration.
12 *
13 * This is a mostly a legacy class. New uses should not be added.
14 *
15 * @ingroup FileRepo
16 * @deprecated since 1.19
17 */
18 class FSRepo extends FileRepo {
19 function __construct( array $info ) {
20 if ( !isset( $info['backend'] ) ) {
21 // B/C settings...
22 $directory = $info['directory'];
23 $deletedDir = isset( $info['deletedDir'] )
24 ? $info['deletedDir']
25 : false;
26 $thumbDir = isset( $info['thumbDir'] )
27 ? $info['thumbDir']
28 : "{$directory}/thumb";
29 $fileMode = isset( $info['fileMode'] )
30 ? $info['fileMode']
31 : 0644;
32
33 $repoName = $info['name'];
34 // Get the FS backend configuration
35 $backend = new FSFileBackend( array(
36 'name' => $info['name'] . '-backend',
37 'lockManager' => 'fsLockManager',
38 'containerPaths' => array(
39 "{$repoName}-public" => "{$directory}",
40 "{$repoName}-temp" => "{$directory}/temp",
41 "{$repoName}-thumb" => $thumbDir,
42 "{$repoName}-deleted" => $deletedDir
43 ),
44 'fileMode' => $fileMode,
45 ) );
46 // Update repo config to use this backend
47 $info['backend'] = $backend;
48 }
49
50 parent::__construct( $info );
51
52 if ( !( $this->backend instanceof FSFileBackend ) ) {
53 throw new MWException( "FSRepo only supports FSFileBackend." );
54 }
55 }
56 }