Don't display multiple language links to the same language
[mediawiki.git] / includes / filerepo / FSRepo.php
blob9c8d85dc2ad3cadc41d8395f250d94449e6653bd
1 <?php
2 /**
3 * A repository for files accessible via the local filesystem.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
21 * @ingroup FileRepo
24 /**
25 * A repository for files accessible via the local filesystem.
26 * Does not support database access or registration.
28 * This is a mostly a legacy class. New uses should not be added.
30 * @ingroup FileRepo
31 * @deprecated since 1.19
33 class FSRepo extends FileRepo {
35 /**
36 * @param $info array
37 * @throws MWException
39 function __construct( array $info ) {
40 if ( !isset( $info['backend'] ) ) {
41 // B/C settings...
42 $directory = $info['directory'];
43 $deletedDir = isset( $info['deletedDir'] )
44 ? $info['deletedDir']
45 : false;
46 $thumbDir = isset( $info['thumbDir'] )
47 ? $info['thumbDir']
48 : "{$directory}/thumb";
49 $fileMode = isset( $info['fileMode'] )
50 ? $info['fileMode']
51 : 0644;
53 $repoName = $info['name'];
54 // Get the FS backend configuration
55 $backend = new FSFileBackend( array(
56 'name' => $info['name'] . '-backend',
57 'lockManager' => 'fsLockManager',
58 'containerPaths' => array(
59 "{$repoName}-public" => "{$directory}",
60 "{$repoName}-temp" => "{$directory}/temp",
61 "{$repoName}-thumb" => $thumbDir,
62 "{$repoName}-deleted" => $deletedDir
64 'fileMode' => $fileMode,
65 ) );
66 // Update repo config to use this backend
67 $info['backend'] = $backend;
70 parent::__construct( $info );
72 if ( !( $this->backend instanceof FSFileBackend ) ) {
73 throw new MWException( "FSRepo only supports FSFileBackend." );