[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorCoreConfigOptions 4 extends PhabricatorApplicationConfigOptions { 5 6 public function getName() { 7 return pht('Core'); 8 } 9 10 public function getDescription() { 11 return pht('Configure core options, including URIs.'); 12 } 13 14 public function getOptions() { 15 if (phutil_is_windows()) { 16 $paths = array(); 17 } else { 18 $paths = array( 19 '/bin', 20 '/usr/bin', 21 '/usr/local/bin', 22 ); 23 } 24 25 $path = getenv('PATH'); 26 27 $proto_doc_href = PhabricatorEnv::getDoclink( 28 'User Guide: Prototype Applications'); 29 $proto_doc_name = pht('User Guide: Prototype Applications'); 30 $applications_app_href = '/applications/'; 31 32 return array( 33 $this->newOption('phabricator.base-uri', 'string', null) 34 ->setLocked(true) 35 ->setSummary(pht('URI where Phabricator is installed.')) 36 ->setDescription( 37 pht( 38 'Set the URI where Phabricator is installed. Setting this '. 39 'improves security by preventing cookies from being set on other '. 40 'domains, and allows daemons to send emails with links that have '. 41 'the correct domain.')) 42 ->addExample('http://phabricator.example.com/', pht('Valid Setting')), 43 $this->newOption('phabricator.production-uri', 'string', null) 44 ->setSummary( 45 pht('Primary install URI, for multi-environment installs.')) 46 ->setDescription( 47 pht( 48 'If you have multiple Phabricator environments (like a '. 49 'development/staging environment for working on testing '. 50 'Phabricator, and a production environment for deploying it), '. 51 'set the production environment URI here so that emails and other '. 52 'durable URIs will always generate with links pointing at the '. 53 'production environment. If unset, defaults to '. 54 '{{phabricator.base-uri}}. Most installs do not need to set '. 55 'this option.')) 56 ->addExample('http://phabricator.example.com/', pht('Valid Setting')), 57 $this->newOption('phabricator.allowed-uris', 'list<string>', array()) 58 ->setLocked(true) 59 ->setSummary(pht('Alternative URIs that can access Phabricator.')) 60 ->setDescription( 61 pht( 62 "These alternative URIs will be able to access 'normal' pages ". 63 "on your Phabricator install. Other features such as OAuth ". 64 "won't work. The major use case for this is moving installs ". 65 "across domains.")) 66 ->addExample( 67 "http://phabricator2.example.com/\n". 68 "http://phabricator3.example.com/", 69 pht('Valid Setting')), 70 $this->newOption('phabricator.timezone', 'string', null) 71 ->setSummary( 72 pht('The timezone Phabricator should use.')) 73 ->setDescription( 74 pht( 75 "PHP requires that you set a timezone in your php.ini before ". 76 "using date functions, or it will emit a warning. If this isn't ". 77 "possible (for instance, because you are using HPHP) you can set ". 78 "some valid constant for date_default_timezone_set() here and ". 79 "Phabricator will set it on your behalf, silencing the warning.")) 80 ->addExample('America/New_York', pht('US East (EDT)')) 81 ->addExample('America/Chicago', pht('US Central (CDT)')) 82 ->addExample('America/Boise', pht('US Mountain (MDT)')) 83 ->addExample('America/Los_Angeles', pht('US West (PDT)')), 84 $this->newOption('phabricator.cookie-prefix', 'string', null) 85 ->setSummary( 86 pht('Set a string Phabricator should use to prefix '. 87 'cookie names')) 88 ->setDescription( 89 pht( 90 'Cookies set for x.com are also sent for y.x.com. Assuming '. 91 'Phabricator instances are running on both domains, this will '. 92 'create a collision preventing you from logging in.')) 93 ->addExample('dev', pht('Prefix cookie with "dev"')), 94 $this->newOption('phabricator.show-prototypes', 'bool', false) 95 ->setBoolOptions( 96 array( 97 pht('Enable Prototypes'), 98 pht('Disable Prototypes'), 99 )) 100 ->setSummary( 101 pht( 102 'Install applications which are still under development.')) 103 ->setDescription( 104 pht( 105 "IMPORTANT: The upstream does not provide support for prototype ". 106 "applications.". 107 "\n\n". 108 "Phabricator includes prototype applications which are in an ". 109 "**early stage of development**. By default, prototype ". 110 "applications are not installed, because they are often not yet ". 111 "developed enough to be generally usable. You can enable ". 112 "this option to install them if you're developing Phabricator ". 113 "or are interested in previewing upcoming features.". 114 "\n\n". 115 "To learn more about prototypes, see [[ %s | %s ]].". 116 "\n\n". 117 "After enabling prototypes, you can selectively uninstall them ". 118 "(like normal applications).", 119 $proto_doc_href, 120 $proto_doc_name)), 121 $this->newOption('phabricator.serious-business', 'bool', false) 122 ->setBoolOptions( 123 array( 124 pht('Serious business'), 125 pht('Shenanigans'), // That should be interesting to translate. :P 126 )) 127 ->setSummary( 128 pht('Allows you to remove levity and jokes from the UI.')) 129 ->setDescription( 130 pht( 131 'By default, Phabricator includes some flavor text in the UI, '. 132 'like a prompt to "Weigh In" rather than "Add Comment" in '. 133 'Maniphest. If you\'d prefer more traditional UI strings like '. 134 '"Add Comment", you can set this flag to disable most of the '. 135 'extra flavor.')), 136 $this->newOption('remarkup.ignored-object-names', 'string', '/^(Q|V)\d$/') 137 ->setSummary( 138 pht('Text values that match this regex and are also object names '. 139 'will not be linked.')) 140 ->setDescription( 141 pht( 142 'By default, Phabricator links object names in Remarkup fields '. 143 'to the corresponding object. This regex can be used to modify '. 144 'this behavior; object names that match this regex will not be '. 145 'linked.')), 146 $this->newOption('environment.append-paths', 'list<string>', $paths) 147 ->setSummary( 148 pht('These paths get appended to your \$PATH envrionment variable.')) 149 ->setDescription( 150 pht( 151 "Phabricator occasionally shells out to other binaries on the ". 152 "server. An example of this is the `pygmentize` command, used ". 153 "to syntax-highlight code written in languages other than PHP. ". 154 "By default, it is assumed that these binaries are in the \$PATH ". 155 "of the user running Phabricator (normally 'apache', 'httpd', or ". 156 "'nobody'). Here you can add extra directories to the \$PATH ". 157 "environment variable, for when these binaries are in ". 158 "non-standard locations.\n\n". 159 "Note that you can also put binaries in ". 160 "`phabricator/support/bin/` (for example, by symlinking them).\n\n". 161 "The current value of PATH after configuration is applied is:\n\n". 162 " lang=text\n". 163 " %s", $path)) 164 ->setLocked(true) 165 ->addExample('/usr/local/bin', pht('Add One Path')) 166 ->addExample("/usr/bin\n/usr/local/bin", pht('Add Multiple Paths')), 167 $this->newOption('config.lock', 'set', array()) 168 ->setLocked(true) 169 ->setDescription(pht('Additional configuration options to lock.')), 170 $this->newOption('config.hide', 'set', array()) 171 ->setLocked(true) 172 ->setDescription(pht('Additional configuration options to hide.')), 173 $this->newOption('config.mask', 'set', array()) 174 ->setLocked(true) 175 ->setDescription(pht('Additional configuration options to mask.')), 176 $this->newOption('config.ignore-issues', 'set', array()) 177 ->setLocked(true) 178 ->setDescription(pht('Setup issues to ignore.')), 179 $this->newOption('phabricator.env', 'string', null) 180 ->setLocked(true) 181 ->setDescription(pht('Internal.')), 182 $this->newOption('test.value', 'wild', null) 183 ->setLocked(true) 184 ->setDescription(pht('Unit test value.')), 185 $this->newOption('phabricator.uninstalled-applications', 'set', array()) 186 ->setLocked(true) 187 ->setLockedMessage(pht( 188 'Use the %s to manage installed applications.', 189 phutil_tag( 190 'a', 191 array( 192 'href' => $applications_app_href, 193 ), 194 pht('Applications application')))) 195 ->setDescription( 196 pht('Array containing list of Uninstalled applications.')), 197 $this->newOption('phabricator.application-settings', 'wild', array()) 198 ->setLocked(true) 199 ->setDescription( 200 pht('Customized settings for Phabricator applications.')), 201 $this->newOption('welcome.html', 'string', null) 202 ->setLocked(true) 203 ->setDescription( 204 pht('Custom HTML to show on the main Phabricator dashboard.')), 205 $this->newOption('phabricator.cache-namespace', 'string', null) 206 ->setLocked(true) 207 ->setDescription(pht('Cache namespace.')), 208 $this->newOption('phabricator.allow-email-users', 'bool', false) 209 ->setBoolOptions( 210 array( 211 pht('Allow'), 212 pht('Disallow'), 213 ))->setDescription( 214 pht( 215 'Allow non-members to interact with tasks over email.')), 216 ); 217 218 } 219 220 protected function didValidateOption( 221 PhabricatorConfigOption $option, 222 $value) { 223 224 $key = $option->getKey(); 225 if ($key == 'phabricator.base-uri' || 226 $key == 'phabricator.production-uri') { 227 228 $uri = new PhutilURI($value); 229 $protocol = $uri->getProtocol(); 230 if ($protocol !== 'http' && $protocol !== 'https') { 231 throw new PhabricatorConfigValidationException( 232 pht( 233 "Config option '%s' is invalid. The URI must start with ". 234 "'http://' or 'https://'.", 235 $key)); 236 } 237 238 $domain = $uri->getDomain(); 239 if (strpos($domain, '.') === false) { 240 throw new PhabricatorConfigValidationException( 241 pht( 242 "Config option '%s' is invalid. The URI must contain a dot ('.'), ". 243 "like 'http://example.com/', not just a bare name like ". 244 "'http://example/'. Some web browsers will not set cookies on ". 245 "domains with no TLD.", 246 $key)); 247 } 248 249 $path = $uri->getPath(); 250 if ($path !== '' && $path !== '/') { 251 throw new PhabricatorConfigValidationException( 252 pht( 253 "Config option '%s' is invalid. The URI must NOT have a path, ". 254 "e.g. 'http://phabricator.example.com/' is OK, but ". 255 "'http://example.com/phabricator/' is not. Phabricator must be ". 256 "installed on an entire domain; it can not be installed on a ". 257 "path.", 258 $key)); 259 } 260 } 261 262 263 if ($key === 'phabricator.timezone') { 264 $old = date_default_timezone_get(); 265 $ok = @date_default_timezone_set($value); 266 @date_default_timezone_set($old); 267 268 if (!$ok) { 269 throw new PhabricatorConfigValidationException( 270 pht( 271 "Config option '%s' is invalid. The timezone identifier must ". 272 "be a valid timezone identifier recognized by PHP, like ". 273 "'America/Los_Angeles'. You can find a list of valid identifiers ". 274 "here: %s", 275 $key, 276 'http://php.net/manual/timezones.php')); 277 } 278 } 279 280 281 282 } 283 284 285 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |