Allow configuration to be explicitly validated, including validation of complex attributes
Summary: - Allows us to implement setup warnings for edits which don't go through the web UI, e.g. "you edited a config file and set value X to something goofy". - Allows us to implement more sophisticated validations, beyond basic type checks (e.g., "phabricator.base-uri" must be a URI). - Fixes T358 (or, close enough -- fixes it for all options which have been migrated as per T2255. Test Plan: Set "darkconsole.enabled" to "xyz" in my config, observed setup warning. Added fake validation, observed web UI edit error. Reviewers: codeblock, btrahan Reviewed By: codeblock CC: aran Maniphest Tasks: T2255, T358 Differential Revision: https://secure.phabricator.com/D4315
This commit is contained in:
@@ -78,10 +78,15 @@ final class PhabricatorConfigEditController
|
||||
PhabricatorContentSource::SOURCE_WEB,
|
||||
array(
|
||||
'ip' => $request->getRemoteAddr(),
|
||||
)))
|
||||
->applyTransactions($config_entry, array($xaction));
|
||||
)));
|
||||
|
||||
return id(new AphrontRedirectResponse())->setURI($done_uri);
|
||||
try {
|
||||
$editor->applyTransactions($config_entry, array($xaction));
|
||||
return id(new AphrontRedirectResponse())->setURI($done_uri);
|
||||
} catch (PhabricatorConfigValidationException $ex) {
|
||||
$e_value = pht('Invalid');
|
||||
$errors[] = $ex->getMessage();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$display_value = $this->getDisplayValue($option, $config_entry);
|
||||
|
||||
Reference in New Issue
Block a user