Remove product literal strings in "pht()", part 5
[phabricator.git] / src / applications / files / config / PhabricatorFilesConfigOptions.php
blob735ddfcb0d71abcdead8318d112f43197ad70938
1 <?php
3 final class PhabricatorFilesConfigOptions
4 extends PhabricatorApplicationConfigOptions {
6 public function getName() {
7 return pht('Files');
10 public function getDescription() {
11 return pht('Configure files and file storage.');
14 public function getIcon() {
15 return 'fa-file';
18 public function getGroup() {
19 return 'apps';
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(
53 'image/jpeg' => true,
54 'image/jpg' => true,
55 'image/png' => true,
56 'image/gif' => true,
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,
68 'audio/mpeg' => true,
69 'audio/ogg' => 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.)
75 'video/mp4' => true,
76 'video/ogg' => true,
77 'video/quicktime' => true,
78 'application/ogg' => true,
81 $video_default = array(
82 'video/mp4' => true,
83 'video/ogg' => true,
84 'video/webm' => true,
85 'video/quicktime' => true,
86 'application/ogg' => true,
89 // largely lifted from http://en.wikipedia.org/wiki/Internet_media_type
90 $icon_default = array(
91 // audio file icon
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',
101 // movie file icon
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',
111 // pdf file icon
112 'application/pdf' => 'fa-file-pdf-o',
113 // zip file icon
114 'application/zip' => 'fa-file-zip-o',
115 // msword icon
116 'application/msword' => 'fa-file-word-o',
117 // msexcel
118 'application/vnd.ms-excel' => 'fa-file-excel-o',
119 // mspowerpoint
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
127 // discussion).
129 return array(
130 $this->newOption('files.viewable-mime-types', 'wild', $viewable_default)
131 ->setLocked(true)
132 ->setSummary(
133 pht('Configure which MIME types are viewable in the browser.'))
134 ->setDescription(
135 pht(
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.".
140 "\n\n".
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 ".
143 "the browser.")),
144 $this->newOption('files.image-mime-types', 'set', $image_default)
145 ->setLocked(true)
146 ->setSummary(pht('Configure which MIME types are images.'))
147 ->setDescription(
148 pht(
149 'List of MIME types which can be used as the `%s` for an `%s` tag.',
150 'src',
151 '<img />')),
152 $this->newOption('files.audio-mime-types', 'set', $audio_default)
153 ->setLocked(true)
154 ->setSummary(pht('Configure which MIME types are audio.'))
155 ->setDescription(
156 pht(
157 'List of MIME types which can be rendered with an `%s` tag.',
158 '<audio />')),
159 $this->newOption('files.video-mime-types', 'set', $video_default)
160 ->setLocked(true)
161 ->setSummary(pht('Configure which MIME types are video.'))
162 ->setDescription(
163 pht(
164 'List of MIME types which can be rendered with a `%s` tag.',
165 '<video />')),
166 $this->newOption('files.icon-mime-types', 'wild', $icon_default)
167 ->setLocked(true)
168 ->setSummary(pht('Configure which MIME types map to which icons.'))
169 ->setDescription(
170 pht(
171 'Map of MIME type to icon name. MIME types which can not be '.
172 'found default to icon `%s`.',
173 'doc_files')),
174 $this->newOption('storage.mysql-engine.max-size', 'int', 1000000)
175 ->setSummary(
176 pht(
177 'Configure the largest file which will be put into the MySQL '.
178 'storage engine.')),
179 $this->newOption('storage.local-disk.path', 'string', null)
180 ->setLocked(true)
181 ->setSummary(pht('Local storage disk path.'))
182 ->setDescription(
183 pht(
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.'))
195 ->setDescription(
196 pht(
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' ".
199 "group.")),
200 $this->newOption('files.enable-imagemagick', 'bool', false)
201 ->setBoolOptions(
202 array(
203 pht('Enable'),
204 pht('Disable'),
206 ->setDescription(
207 pht(
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.',
212 'convert')),