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