[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/files/config/ -> PhabricatorFilesConfigOptions.php (source)

   1  <?php
   2  
   3  final class PhabricatorFilesConfigOptions
   4    extends PhabricatorApplicationConfigOptions {
   5  
   6    public function getName() {
   7      return pht('Files');
   8    }
   9  
  10    public function getDescription() {
  11      return pht('Configure files and file storage.');
  12    }
  13  
  14    public function getOptions() {
  15      $viewable_default = array(
  16        'image/jpeg'  => 'image/jpeg',
  17        'image/jpg'   => 'image/jpg',
  18        'image/png'   => 'image/png',
  19        'image/gif'   => 'image/gif',
  20        'text/plain'  => 'text/plain; charset=utf-8',
  21        'text/x-diff' => 'text/plain; charset=utf-8',
  22  
  23        // ".ico" favicon files, which have mime type diversity. See:
  24        // http://en.wikipedia.org/wiki/ICO_(file_format)#MIME_type
  25        'image/x-ico'               => 'image/x-icon',
  26        'image/x-icon'              => 'image/x-icon',
  27        'image/vnd.microsoft.icon'  => 'image/x-icon',
  28  
  29        'audio/x-wav'     => 'audio/x-wav',
  30        'application/ogg' => 'application/ogg',
  31        'audio/mpeg'      => 'audio/mpeg',
  32      );
  33  
  34      $image_default = array(
  35        'image/jpeg'                => true,
  36        'image/jpg'                 => true,
  37        'image/png'                 => true,
  38        'image/gif'                 => true,
  39        'image/x-ico'               => true,
  40        'image/x-icon'              => true,
  41        'image/vnd.microsoft.icon'  => true,
  42      );
  43  
  44      $audio_default = array(
  45        'audio/x-wav'     => true,
  46        'application/ogg' => true,
  47        'audio/mpeg'      => true,
  48      );
  49  
  50      // largely lifted from http://en.wikipedia.org/wiki/Internet_media_type
  51      $icon_default = array(
  52        // audio file icon
  53        'audio/basic' => 'docs_audio',
  54        'audio/L24' => 'docs_audio',
  55        'audio/mp4' => 'docs_audio',
  56        'audio/mpeg' => 'docs_audio',
  57        'audio/ogg' => 'docs_audio',
  58        'audio/vorbis' => 'docs_audio',
  59        'audio/vnd.rn-realaudio' => 'docs_audio',
  60        'audio/vnd.wave' => 'docs_audio',
  61        'audio/webm' => 'docs_audio',
  62        // movie file icon
  63        'video/mpeg' => 'docs_movie',
  64        'video/mp4' => 'docs_movie',
  65        'video/ogg' => 'docs_movie',
  66        'video/quicktime' => 'docs_movie',
  67        'video/webm' => 'docs_movie',
  68        'video/x-matroska' => 'docs_movie',
  69        'video/x-ms-wmv' => 'docs_movie',
  70        'video/x-flv' => 'docs_movie',
  71        // pdf file icon
  72        'application/pdf' => 'docs_pdf',
  73        // zip file icon
  74        'application/zip' => 'docs_zip',
  75        // msword icon
  76        'application/msword' => 'docs_doc',
  77      ) + array_fill_keys(array_keys($image_default), 'docs_image');
  78  
  79      return array(
  80        $this->newOption('files.viewable-mime-types', 'wild', $viewable_default)
  81          ->setSummary(
  82            pht('Configure which MIME types are viewable in the browser.'))
  83          ->setDescription(
  84            pht(
  85              'Configure which uploaded file types may be viewed directly '.
  86              'in the browser. Other file types will be downloaded instead '.
  87              'of displayed. This is mainly a usability consideration, since '.
  88              'browsers tend to freak out when viewing enormous binary files.'.
  89              "\n\n".
  90              'The keys in this map are vieweable MIME types; the values are '.
  91              'the MIME types they are delivered as when they are viewed in '.
  92              'the browser.')),
  93        $this->newOption('files.image-mime-types', 'set', $image_default)
  94          ->setSummary(pht('Configure which MIME types are images.'))
  95          ->setDescription(
  96            pht(
  97              'List of MIME types which can be used as the `src` for an '.
  98              '`<img />` tag.')),
  99        $this->newOption('files.audio-mime-types', 'set', $audio_default)
 100          ->setSummary(pht('Configure which MIME types are audio.'))
 101          ->setDescription(
 102            pht(
 103              'List of MIME types which can be used to render an '.
 104              '`<audio />` tag.')),
 105        $this->newOption('files.icon-mime-types', 'wild', $icon_default)
 106          ->setSummary(pht('Configure which MIME types map to which icons.'))
 107          ->setDescription(
 108            pht(
 109              'Map of MIME type to icon name. MIME types which can not be '.
 110              'found default to icon `doc_files`.')),
 111        $this->newOption('storage.mysql-engine.max-size', 'int', 1000000)
 112          ->setSummary(
 113            pht(
 114              'Configure the largest file which will be put into the MySQL '.
 115              'storage engine.')),
 116        $this->newOption('storage.local-disk.path', 'string', null)
 117          ->setLocked(true)
 118          ->setSummary(pht('Local storage disk path.'))
 119          ->setDescription(
 120            pht(
 121              "Phabricator provides a local disk storage engine, which just ".
 122              "writes files to some directory on local disk. The webserver ".
 123              "must have read/write permissions on this directory. This is ".
 124              "straightforward and suitable for most installs, but will not ".
 125              "scale past one web frontend unless the path is actually an NFS ".
 126              "mount, since you'll end up with some of the files written to ".
 127              "each web frontend and no way for them to share. To use the ".
 128              "local disk storage engine, specify the path to a directory ".
 129              "here. To disable it, specify null.")),
 130       $this->newOption('storage.s3.bucket', 'string', null)
 131          ->setSummary(pht('Amazon S3 bucket.'))
 132          ->setDescription(
 133            pht(
 134              "Set this to a valid Amazon S3 bucket to store files there. You ".
 135              "must also configure S3 access keys in the 'Amazon Web Services' ".
 136              "group.")),
 137       $this->newOption(
 138         'storage.engine-selector',
 139         'class',
 140         'PhabricatorDefaultFileStorageEngineSelector')
 141          ->setBaseClass('PhabricatorFileStorageEngineSelector')
 142          ->setSummary(pht('Storage engine selector.'))
 143          ->setDescription(
 144            pht(
 145              'Phabricator uses a storage engine selector to choose which '.
 146              'storage engine to use when writing file data. If you add new '.
 147              'storage engines or want to provide very custom rules (e.g., '.
 148              'write images to one storage engine and other files to a '.
 149              'different one), you can provide an alternate implementation '.
 150              'here. The default engine will use choose MySQL, Local Disk, and '.
 151              'S3, in that order, if they have valid configurations above and '.
 152              'a file fits within configured limits.')),
 153       $this->newOption('storage.upload-size-limit', 'string', null)
 154          ->setSummary(
 155            pht('Limit to users in interfaces which allow uploading.'))
 156          ->setDescription(
 157            pht(
 158              "Set the size of the largest file a user may upload. This is ".
 159              "used to render text like 'Maximum file size: 10MB' on ".
 160              "interfaces where users can upload files, and files larger than ".
 161              "this size will be rejected. \n\n".
 162              "NOTE: **Setting this to a large size is NOT sufficient to ".
 163              "allow users to upload large files. You must also configure a ".
 164              "number of other settings.** To configure file upload limits, ".
 165              "consult the article 'Configuring File Upload Limits' in the ".
 166              "documentation. Once you've configured some limit across all ".
 167              "levels of the server, you can set this limit to an appropriate ".
 168              "value and the UI will then reflect the actual configured ".
 169              "limit.\n\n".
 170              "Specify this limit in bytes, or using a 'K', 'M', or 'G' ".
 171              "suffix."))
 172          ->addExample('10M', pht('Allow Uploads 10MB or Smaller')),
 173       $this->newOption(
 174          'metamta.files.public-create-email',
 175          'string',
 176          null)
 177          ->setDescription(pht('Allow uploaded files via email.')),
 178       $this->newOption(
 179          'metamta.files.subject-prefix',
 180          'string',
 181          '[File]')
 182          ->setDescription(pht('Subject prefix for Files email.')),
 183       $this->newOption('files.enable-imagemagick', 'bool', false)
 184         ->setBoolOptions(
 185           array(
 186             pht('Enable'),
 187             pht('Disable'),
 188           ))->setDescription(
 189               pht("This option will enable animated gif images".
 190                    "to be set as profile pictures. The 'convert' binary ".
 191                    "should be available to the webserver for this to work")),
 192  
 193      );
 194    }
 195  
 196  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1