MediaWiki  REL1_19
FSRepo.php
Go to the documentation of this file.
00001 <?php
00018 class FSRepo extends FileRepo {
00019         function __construct( array $info ) {
00020                 if ( !isset( $info['backend'] ) ) {
00021                         // B/C settings...
00022                         $directory = $info['directory'];
00023                         $deletedDir = isset( $info['deletedDir'] )
00024                                 ? $info['deletedDir']
00025                                 : false;
00026                         $thumbDir = isset( $info['thumbDir'] )
00027                                 ? $info['thumbDir']
00028                                 : "{$directory}/thumb";
00029                         $fileMode = isset( $info['fileMode'] )
00030                                 ? $info['fileMode']
00031                                 : 0644;
00032 
00033                         $repoName = $info['name'];
00034                         // Get the FS backend configuration
00035                         $backend = new FSFileBackend( array(
00036                                 'name'           => $info['name'] . '-backend',
00037                                 'lockManager'    => 'fsLockManager',
00038                                 'containerPaths' => array(
00039                                         "{$repoName}-public"  => "{$directory}",
00040                                         "{$repoName}-temp"    => "{$directory}/temp",
00041                                         "{$repoName}-thumb"   => $thumbDir,
00042                                         "{$repoName}-deleted" => $deletedDir
00043                                 ),
00044                                 'fileMode'       => $fileMode,
00045                         ) );
00046                         // Update repo config to use this backend
00047                         $info['backend'] = $backend;
00048                 }
00049 
00050                 parent::__construct( $info );
00051 
00052                 if ( !( $this->backend instanceof FSFileBackend ) ) {
00053                         throw new MWException( "FSRepo only supports FSFileBackend." );
00054                 }
00055         }
00056 }