3 final class PhabricatorFilesConfigOptions
4 extends PhabricatorApplicationConfigOptions
{
6 public function getName() {
10 public function getDescription() {
11 return pht('Configure files and file storage.');
14 public function getIcon() {
18 public function getGroup() {
22 public function getOptions() {
23 $viewable_default = array(
24 'image/jpeg' => 'image/jpeg',
25 'image/jpg' => 'image/jpg',
26 'image/png' => 'image/png',
27 'image/gif' => 'image/gif',
28 'text/plain' => 'text/plain; charset=utf-8',
29 'text/x-diff' => 'text/plain; charset=utf-8',
31 // ".ico" favicon files, which have mime type diversity. See:
32 // http://en.wikipedia.org/wiki/ICO_(file_format)#MIME_type
33 'image/x-ico' => 'image/x-icon',
34 'image/x-icon' => 'image/x-icon',
35 'image/vnd.microsoft.icon' => 'image/x-icon',
37 // This is a generic type for both OGG video and OGG audio.
38 'application/ogg' => 'application/ogg',
40 'audio/x-wav' => 'audio/x-wav',
41 'audio/mpeg' => 'audio/mpeg',
42 'audio/ogg' => 'audio/ogg',
44 'video/mp4' => 'video/mp4',
45 'video/ogg' => 'video/ogg',
46 'video/webm' => 'video/webm',
47 'video/quicktime' => 'video/quicktime',
49 'application/pdf' => 'application/pdf',
52 $image_default = array(
57 'image/x-ico' => true,
58 'image/x-icon' => true,
59 'image/vnd.microsoft.icon' => true,
63 // The "application/ogg" type is listed as both an audio and video type,
64 // because it may contain either type of content.
66 $audio_default = array(
67 'audio/x-wav' => true,
71 // These are video or ambiguous types, but can be forced to render as
72 // audio with `media=audio`, which seems to work properly in browsers.
73 // (For example, you can embed a music video as audio if you just want
74 // to set the mood for your task without distracting viewers.)
77 'video/quicktime' => true,
78 'application/ogg' => true,
81 $video_default = array(
85 'video/quicktime' => true,
86 'application/ogg' => true,
89 // largely lifted from http://en.wikipedia.org/wiki/Internet_media_type
90 $icon_default = array(
92 'audio/basic' => 'fa-file-audio-o',
93 'audio/L24' => 'fa-file-audio-o',
94 'audio/mp4' => 'fa-file-audio-o',
95 'audio/mpeg' => 'fa-file-audio-o',
96 'audio/ogg' => 'fa-file-audio-o',
97 'audio/vorbis' => 'fa-file-audio-o',
98 'audio/vnd.rn-realaudio' => 'fa-file-audio-o',
99 'audio/vnd.wave' => 'fa-file-audio-o',
100 'audio/webm' => 'fa-file-audio-o',
102 'video/mpeg' => 'fa-file-movie-o',
103 'video/mp4' => 'fa-file-movie-o',
104 'application/ogg' => 'fa-file-movie-o',
105 'video/ogg' => 'fa-file-movie-o',
106 'video/quicktime' => 'fa-file-movie-o',
107 'video/webm' => 'fa-file-movie-o',
108 'video/x-matroska' => 'fa-file-movie-o',
109 'video/x-ms-wmv' => 'fa-file-movie-o',
110 'video/x-flv' => 'fa-file-movie-o',
112 'application/pdf' => 'fa-file-pdf-o',
114 'application/zip' => 'fa-file-zip-o',
116 'application/msword' => 'fa-file-word-o',
118 'application/vnd.ms-excel' => 'fa-file-excel-o',
120 'application/vnd.ms-powerpoint' => 'fa-file-powerpoint-o',
122 ) +
array_fill_keys(array_keys($image_default), 'fa-file-image-o');
124 // NOTE: These options are locked primarily because adding "text/plain"
125 // as an image MIME type increases SSRF vulnerability by allowing users
126 // to load text files from remote servers as "images" (see T6755 for
130 $this->newOption('files.viewable-mime-types', 'wild', $viewable_default)
133 pht('Configure which MIME types are viewable in the browser.'))
136 "Configure which uploaded file types may be viewed directly ".
137 "in the browser. Other file types will be downloaded instead ".
138 "of displayed. This is mainly a usability consideration, since ".
139 "browsers tend to freak out when viewing very large binary files.".
141 "The keys in this map are viewable MIME types; the values are ".
142 "the MIME types they are delivered as when they are viewed in ".
144 $this->newOption('files.image-mime-types', 'set', $image_default)
146 ->setSummary(pht('Configure which MIME types are images.'))
149 'List of MIME types which can be used as the `%s` for an `%s` tag.',
152 $this->newOption('files.audio-mime-types', 'set', $audio_default)
154 ->setSummary(pht('Configure which MIME types are audio.'))
157 'List of MIME types which can be rendered with an `%s` tag.',
159 $this->newOption('files.video-mime-types', 'set', $video_default)
161 ->setSummary(pht('Configure which MIME types are video.'))
164 'List of MIME types which can be rendered with a `%s` tag.',
166 $this->newOption('files.icon-mime-types', 'wild', $icon_default)
168 ->setSummary(pht('Configure which MIME types map to which icons.'))
171 'Map of MIME type to icon name. MIME types which can not be '.
172 'found default to icon `%s`.',
174 $this->newOption('storage.mysql-engine.max-size', 'int', 1000000)
177 'Configure the largest file which will be put into the MySQL '.
179 $this->newOption('storage.local-disk.path', 'string', null)
181 ->setSummary(pht('Local storage disk path.'))
184 "Phabricator provides a local disk storage engine, which just ".
185 "writes files to some directory on local disk. The webserver ".
186 "must have read/write permissions on this directory. This is ".
187 "straightforward and suitable for most installs, but will not ".
188 "scale past one web frontend unless the path is actually an NFS ".
189 "mount, since you'll end up with some of the files written to ".
190 "each web frontend and no way for them to share. To use the ".
191 "local disk storage engine, specify the path to a directory ".
192 "here. To disable it, specify null.")),
193 $this->newOption('storage.s3.bucket', 'string', null)
194 ->setSummary(pht('Amazon S3 bucket.'))
197 "Set this to a valid Amazon S3 bucket to store files there. You ".
198 "must also configure S3 access keys in the 'Amazon Web Services' ".
200 $this->newOption('files.enable-imagemagick', 'bool', false)
208 'This option will use Imagemagick to rescale images, so animated '.
209 'GIFs can be thumbnailed and set as profile pictures. Imagemagick '.
210 'must be installed and the "%s" binary must be available to '.
211 'the webserver for this to work.',