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

Default to "True" and "False" for bool options.

Summary:
Rather than throwing if we don't `setOptions()`, let's just default to `true`
and `false`.

Test Plan:
Removed a `setOptions()` call temporarily and saw options default to
`true` / `false`.

Reviewers: epriestley, btrahan, chad

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2255

Differential Revision: https://secure.phabricator.com/D4368
This commit is contained in:
Ricky Elrod 2013-01-09 08:14:26 -08:00 committed by epriestley
parent f12dbe36d6
commit 71b5d8f584
15 changed files with 48 additions and 42 deletions

View file

@ -350,8 +350,8 @@ final class PhabricatorConfigEditController
->setOptions(
array(
'' => pht('(Use Default)'),
'true' => idx($option->getOptions(), 0),
'false' => idx($option->getOptions(), 1),
'true' => idx($option->getBoolOptions(), 0),
'false' => idx($option->getBoolOptions(), 1),
));
break;
case 'class':

View file

@ -15,7 +15,7 @@ final class PhabricatorAuthenticationConfigOptions
return array(
$this->newOption(
'auth.password-auth-enabled', 'bool', true)
->setOptions(
->setBoolOptions(
array(
pht("Allow password authentication"),
pht("Don't allow password authentication")
@ -43,7 +43,7 @@ final class PhabricatorAuthenticationConfigOptions
"Maximum number of simultaneous Conduit sessions each user is ".
"permitted to have.")),
$this->newOption('auth.sshkeys.enabled', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Enable SSH key storage"),
pht("Disable SSH key storage")))
@ -58,7 +58,7 @@ final class PhabricatorAuthenticationConfigOptions
"authentication; in most situations you can leave this ".
"disabled.")),
$this->newOption('auth.require-email-verification', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Require email verification"),
pht("Don't require email verification")
@ -95,7 +95,7 @@ final class PhabricatorAuthenticationConfigOptions
"appear on the login screen. Normally, you'd use this to provide ".
"login or registration instructions to users.")),
$this->newOption('account.editable', 'bool', true)
->setOptions(
->setBoolOptions(
array(
pht("Allow editing"),
pht("Prevent editing")

View file

@ -9,7 +9,7 @@ final class PhabricatorConfigOption
private $summary;
private $description;
private $type;
private $options;
private $boolOptions;
private $group;
private $examples;
private $locked;
@ -77,13 +77,19 @@ final class PhabricatorConfigOption
return $this->group;
}
public function setOptions(array $options) {
$this->options = $options;
public function setBoolOptions(array $options) {
$this->boolOptions = $options;
return $this;
}
public function getOptions() {
return $this->options;
public function getBoolOptions() {
if ($this->boolOptions) {
return $this->boolOptions;
}
return array(
pht('True'),
pht('False'),
);
}
public function setKey($key) {

View file

@ -51,7 +51,7 @@ final class PhabricatorCoreConfigOptions
->addExample('America/Boise', pht('US Mountain (MDT)'))
->addExample('America/Los_Angeles', pht('US West (PDT)')),
$this->newOption('phabricator.serious-business', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht('Serious business'),
pht('Shenanigans'), // That should be interesting to translate. :P

View file

@ -14,7 +14,7 @@ final class PhabricatorDeveloperConfigOptions
public function getOptions() {
return array(
$this->newOption('darkconsole.enabled', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Enable DarkConsole"),
pht("Disable DarkConsole"),
@ -33,7 +33,7 @@ final class PhabricatorDeveloperConfigOptions
"stack traces, and configuration) so you generally should not ".
"turn it on in production.")),
$this->newOption('darkconsole.always-on', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Always Activate DarkConsole"),
pht("Require DarkConsole Activation"),
@ -48,7 +48,7 @@ final class PhabricatorDeveloperConfigOptions
"You must enable DarkConsole by setting {{darkconsole.enabled}} ".
"before this option will have any effect.")),
$this->newOption('debug.stop-on-redirect', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Stop Before HTTP Redirect"),
pht("Use Normal HTTP Redirects"),
@ -87,7 +87,7 @@ final class PhabricatorDeveloperConfigOptions
"set it to 1 in order to debug performance problems.\n\n".
"NOTE: You must install XHProf for profiling to work.")),
$this->newOption('phabricator.show-stack-traces', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht('Show stack traces'),
pht('Hide stack traces'),
@ -99,7 +99,7 @@ final class PhabricatorDeveloperConfigOptions
"default. You can enable traces for development to make it easier ".
"to debug problems.")),
$this->newOption('phabricator.show-error-callout', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht('Show error callout'),
pht('Hide error callout'),
@ -112,7 +112,7 @@ final class PhabricatorDeveloperConfigOptions
"developing Phabricator. A callout is simply a red error at the ".
"top of the page.")),
$this->newOption('celerity.force-disk-reads', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht('Force disk reads'),
pht("Don't force disk reads"),
@ -129,7 +129,7 @@ final class PhabricatorDeveloperConfigOptions
"performance improve with it off) but turn it on in development. ".
"(These settings are the defaults.)")),
$this->newOption('celerity.minify', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht('Minify static resources.'),
pht("Don't minify static resources."),

View file

@ -14,7 +14,7 @@ final class PhabricatorDisqusConfigOptions
public function getOptions() {
return array(
$this->newOption('disqus.auth-enabled', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Enable Disqus Authentication"),
pht("Disable Disqus Authentication"),
@ -23,7 +23,7 @@ final class PhabricatorDisqusConfigOptions
pht(
'Allow users to login to Phabricator using Disqus credentials.')),
$this->newOption('disqus.registration-enabled', 'bool', true)
->setOptions(
->setBoolOptions(
array(
pht("Enable Disqus Registration"),
pht("Disable Disqus Registration"),
@ -33,7 +33,7 @@ final class PhabricatorDisqusConfigOptions
'Allow users to create new Phabricator accounts using Disqus '.
'credentials.')),
$this->newOption('disqus.auth-permanent', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Permanently Bind Disqus Accounts"),
pht("Allow Disqus Account Unlinking"),

View file

@ -14,7 +14,7 @@ final class PhabricatorFacebookConfigOptions
public function getOptions() {
return array(
$this->newOption('facebook.auth-enabled', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Enable Facebook Authentication"),
pht("Disable Facebook Authentication"),
@ -23,7 +23,7 @@ final class PhabricatorFacebookConfigOptions
pht(
'Allow users to login to Phabricator using Facebook credentials.')),
$this->newOption('facebook.registration-enabled', 'bool', true)
->setOptions(
->setBoolOptions(
array(
pht("Enable Facebook Registration"),
pht("Disable Facebook Registration"),
@ -33,7 +33,7 @@ final class PhabricatorFacebookConfigOptions
'Allow users to create new Phabricator accounts using Facebook '.
'credentials.')),
$this->newOption('facebook.auth-permanent', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Permanently Bind Facebook Accounts"),
pht("Allow Facebook Account Unlinking"),
@ -51,7 +51,7 @@ final class PhabricatorFacebookConfigOptions
pht(
'Facebook "Application Secret" to use for Facebook API access.')),
$this->newOption('facebook.require-https-auth', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Require HTTPS"),
pht("Do Not Require HTTPS"),

View file

@ -14,7 +14,7 @@ final class PhabricatorGitHubConfigOptions
public function getOptions() {
return array(
$this->newOption('github.auth-enabled', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Enable GitHub Authentication"),
pht("Disable GitHub Authentication"),
@ -23,7 +23,7 @@ final class PhabricatorGitHubConfigOptions
pht(
'Allow users to login to Phabricator using GitHub credentials.')),
$this->newOption('github.registration-enabled', 'bool', true)
->setOptions(
->setBoolOptions(
array(
pht("Enable GitHub Registration"),
pht("Disable GitHub Registration"),
@ -33,7 +33,7 @@ final class PhabricatorGitHubConfigOptions
'Allow users to create new Phabricator accounts using GitHub '.
'credentials.')),
$this->newOption('github.auth-permanent', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Permanently Bind GitHub Accounts"),
pht("Allow GitHub Account Unlinking"),

View file

@ -14,7 +14,7 @@ final class PhabricatorGoogleConfigOptions
public function getOptions() {
return array(
$this->newOption('google.auth-enabled', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Enable Google Authentication"),
pht("Disable Google Authentication"),
@ -23,7 +23,7 @@ final class PhabricatorGoogleConfigOptions
pht(
'Allow users to login to Phabricator using Google credentials.')),
$this->newOption('google.registration-enabled', 'bool', true)
->setOptions(
->setBoolOptions(
array(
pht("Enable Google Registration"),
pht("Disable Google Registration"),
@ -33,7 +33,7 @@ final class PhabricatorGoogleConfigOptions
'Allow users to create new Phabricator accounts using Google '.
'credentials.')),
$this->newOption('google.auth-permanent', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Permanently Bind Google Accounts"),
pht("Allow Google Account Unlinking"),

View file

@ -14,7 +14,7 @@ final class PhabricatorLDAPConfigOptions
public function getOptions() {
return array(
$this->newOption('ldap.auth-enabled', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Enable LDAP Authentication"),
pht("Disable LDAP Authentication"),
@ -39,7 +39,7 @@ final class PhabricatorLDAPConfigOptions
->setDescription(pht('LDAP base domain name.')),
$this->newOption('ldap.search_attribute', 'string', null),
$this->newOption('ldap.search-first', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Enabled"),
pht("Disabled"),
@ -54,7 +54,7 @@ final class PhabricatorLDAPConfigOptions
$this->newOption('ldap.activedirectory_domain', 'string', null),
$this->newOption('ldap.version', 'int', 3),
$this->newOption('ldap.referrals', 'bool', true)
->setOptions(
->setBoolOptions(
array(
pht("Follow Referrals"),
pht("Do Not Follow Referrals"),

View file

@ -14,7 +14,7 @@ final class PhabricatorNotificationConfigOptions
public function getOptions() {
return array(
$this->newOption('notification.enabled', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Enable Real-Time Notifications"),
pht("Disable Real-Time Notifications"),

View file

@ -14,7 +14,7 @@ final class PhabricatorPolicyConfigOptions
public function getOptions() {
return array(
$this->newOption('policy.allow-public', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht('Allow Public Visibility'),
pht('Require Login')))

View file

@ -15,7 +15,7 @@ final class PhabricatorRecaptchaConfigOptions
return array(
$this->newOption('recaptcha.enabled', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht("Enable Recaptcha"),
pht("Disable Recaptcha"),

View file

@ -73,7 +73,7 @@ final class PhabricatorSecurityConfigOptions
"connection type. Alternatively, you can add a PHP snippet to ".
"the top of this configuration file to directly set ".
"\$_SERVER['HTTPS'] to the correct value."))
->setOptions(
->setBoolOptions(
array(
pht('Force HTTPS'),
pht('Allow HTTP'),

View file

@ -14,7 +14,7 @@ final class PhabricatorDifferentialConfigOptions
public function getOptions() {
return array(
$this->newOption('differential.show-host-field', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht('Disable "Host" Fields'),
pht('Show "Host" Fields'),
@ -30,7 +30,7 @@ final class PhabricatorDifferentialConfigOptions
'development machines. You can set this option to true to enable '.
'these fields.')),
$this->newOption('differential.show-test-plan-field', 'bool', true)
->setOptions(
->setBoolOptions(
array(
pht('Hide "Test Plan" Field'),
pht('Show "Test Plan" Field'),
@ -45,7 +45,7 @@ final class PhabricatorDifferentialConfigOptions
'here. You can also make it optional (instead of required) by '.
'setting {{differential.require-test-plan-field}}.')),
$this->newOption('differential.enable-email-accept', 'bool', false)
->setOptions(
->setBoolOptions(
array(
pht('Disable Email "!accept" Action'),
pht('Enable Email "!accept" Action'),