MediaWiki  REL1_21
FSRepo.php
Go to the documentation of this file.
00001 <?php
00033 class FSRepo extends FileRepo {
00034 
00039         function __construct( array $info ) {
00040                 if ( !isset( $info['backend'] ) ) {
00041                         // B/C settings...
00042                         $directory = $info['directory'];
00043                         $deletedDir = isset( $info['deletedDir'] )
00044                                 ? $info['deletedDir']
00045                                 : false;
00046                         $thumbDir = isset( $info['thumbDir'] )
00047                                 ? $info['thumbDir']
00048                                 : "{$directory}/thumb";
00049                         $transcodedDir = isset( $info['transcodedDir'] )
00050                                 ? $info['transcodedDir']
00051                                 : "{$directory}/transcoded";
00052                         $fileMode = isset( $info['fileMode'] )
00053                                 ? $info['fileMode']
00054                                 : 0644;
00055 
00056                         $repoName = $info['name'];
00057                         // Get the FS backend configuration
00058                         $backend = new FSFileBackend( array(
00059                                 'name'           => $info['name'] . '-backend',
00060                                 'lockManager'    => 'fsLockManager',
00061                                 'containerPaths' => array(
00062                                         "{$repoName}-public"  => "{$directory}",
00063                                         "{$repoName}-temp"    => "{$directory}/temp",
00064                                         "{$repoName}-thumb"   => $thumbDir,
00065                                         "{$repoName}-transcoded"   => $transcodedDir,
00066                                         "{$repoName}-deleted" => $deletedDir
00067                                 ),
00068                                 'fileMode'       => $fileMode,
00069                         ) );
00070                         // Update repo config to use this backend
00071                         $info['backend'] = $backend;
00072                 }
00073 
00074                 parent::__construct( $info );
00075 
00076                 if ( !( $this->backend instanceof FSFileBackend ) ) {
00077                         throw new MWException( "FSRepo only supports FSFileBackend." );
00078                 }
00079         }
00080 }