X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Ffilerepo%2FFSRepo.php;h=22dbdefc10d313fd7c836a1d51d2778d485d2823;hb=2a642ad44a223fe76f61cd6cca822edabb497f71;hp=8dd83335f4a1a12e2d99f6818264a1e702ec1360;hpb=5275f9b097cdae5dbab0845e3ea127086e3a6570;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/filerepo/FSRepo.php b/includes/filerepo/FSRepo.php index 8dd83335f4..22dbdefc10 100644 --- a/includes/filerepo/FSRepo.php +++ b/includes/filerepo/FSRepo.php @@ -7,14 +7,48 @@ */ /** - * A repository for files accessible via the local filesystem. Does not support - * database access or registration. + * 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( $info ) { + 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." ); }