MediaWiki  REL1_20
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                         $fileMode = isset( $info['fileMode'] )
00050                                 ? $info['fileMode']
00051                                 : 0644;
00052 
00053                         $repoName = $info['name'];
00054                         // Get the FS backend configuration
00055                         $backend = new FSFileBackend( array(
00056                                 'name'           => $info['name'] . '-backend',
00057                                 'lockManager'    => 'fsLockManager',
00058                                 'containerPaths' => array(
00059                                         "{$repoName}-public"  => "{$directory}",
00060                                         "{$repoName}-temp"    => "{$directory}/temp",
00061                                         "{$repoName}-thumb"   => $thumbDir,
00062                                         "{$repoName}-deleted" => $deletedDir
00063                                 ),
00064                                 'fileMode'       => $fileMode,
00065                         ) );
00066                         // Update repo config to use this backend
00067                         $info['backend'] = $backend;
00068                 }
00069 
00070                 parent::__construct( $info );
00071 
00072                 if ( !( $this->backend instanceof FSFileBackend ) ) {
00073                         throw new MWException( "FSRepo only supports FSFileBackend." );
00074                 }
00075         }
00076 }