1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Add a setup issue to warn about an unconfigured upload limit

Summary:
Ref T3354. There's no way for us to test most of the config options which actually affect this limit, so the Phabricator config is basically a canary value to indicate "the administrator hasn't configured anything yet".

Raise a setup issue if it isn't set. There's a trail to get here from Files, but we've de-emphasized the old-school upload form so it's hard to unearth.

Emphasize the warning that you need to read the documentation and configure like 30 other things to make this work.

Test Plan: Cleared my config, verified I got the issue, read it, set my config, issue went away.

Reviewers: jamesr, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T3354

Differential Revision: https://secure.phabricator.com/D6185
This commit is contained in:
epriestley 2013-06-12 05:49:41 -07:00
parent 4672705c22
commit ce01d6fc2b
2 changed files with 21 additions and 6 deletions

View file

@ -3,6 +3,21 @@
final class PhabricatorSetupCheckStorage extends PhabricatorSetupCheck { final class PhabricatorSetupCheckStorage extends PhabricatorSetupCheck {
protected function executeChecks() { protected function executeChecks() {
$upload_limit = PhabricatorEnv::getEnvConfig('storage.upload-size-limit');
if (!$upload_limit) {
$message = pht(
'The Phabricator file upload limit is not configured. You may only '.
'be able to upload very small files until you configure it, because '.
'some PHP default limits are very low (as low as 2MB).');
$this
->newIssue('config.storage.upload-size-limit')
->setShortName(pht('Upload Limit'))
->setName(pht('Upload Limit Not Yet Configured'))
->setMessage($message)
->addPhabricatorConfig('storage.upload-size-limit');
}
$local_path = PhabricatorEnv::getEnvConfig('storage.local-disk.path'); $local_path = PhabricatorEnv::getEnvConfig('storage.local-disk.path');
if (!$local_path) { if (!$local_path) {
return; return;

View file

@ -143,17 +143,17 @@ final class PhabricatorFilesConfigOptions
"used to render text like 'Maximum file size: 10MB' on ". "used to render text like 'Maximum file size: 10MB' on ".
"interfaces where users can upload files, and files larger than ". "interfaces where users can upload files, and files larger than ".
"this size will be rejected. \n\n". "this size will be rejected. \n\n".
"Specify this limit in bytes, or using a 'K', 'M', or 'G' ". "NOTE: **Setting this to a large size is NOT sufficient to ".
"suffix.\n\n".
"NOTE: Setting this to a large size is **NOT** sufficient to ".
"allow users to upload large files. You must also configure a ". "allow users to upload large files. You must also configure a ".
"number of other settings. To configure file upload limits, ". "number of other settings.** To configure file upload limits, ".
"consult the article 'Configuring File Upload Limits' in the ". "consult the article 'Configuring File Upload Limits' in the ".
"documentation. Once you've configured some limit across all ". "documentation. Once you've configured some limit across all ".
"levels of the server, you can set this limit to an appropriate ". "levels of the server, you can set this limit to an appropriate ".
"value and the UI will then reflect the actual configured ". "value and the UI will then reflect the actual configured ".
"limit.")) "limit.\n\n".
->addExample('10M', pht("Valid setting.")), "Specify this limit in bytes, or using a 'K', 'M', or 'G' ".
"suffix."))
->addExample('10M', pht("Allow Uploads 10MB or Smaller")),
$this->newOption('files.enable-imagemagick', 'bool', false) $this->newOption('files.enable-imagemagick', 'bool', false)
->setBoolOptions( ->setBoolOptions(
array( array(