@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck {
4
5 public function getDefaultGroup() {
6 return self::GROUP_OTHER;
7 }
8
9 protected function executeChecks() {
10 $ancient_config = self::getAncientConfig();
11
12 $all_keys = PhabricatorEnv::getAllConfigKeys();
13 $all_keys = array_keys($all_keys);
14 sort($all_keys);
15
16 $defined_keys = PhabricatorApplicationConfigOptions::loadAllOptions();
17
18 $stack = PhabricatorEnv::getConfigSourceStack();
19 $stack = $stack->getStack();
20
21 foreach ($all_keys as $key) {
22 if (isset($defined_keys[$key])) {
23 continue;
24 }
25
26 if (isset($ancient_config[$key])) {
27 $summary = pht(
28 'This option has been removed. You may delete it at your '.
29 'convenience.');
30 $message = pht(
31 "The configuration option '%s' has been removed. You may delete ".
32 "it at your convenience.".
33 "\n\n%s",
34 $key,
35 $ancient_config[$key]);
36 $short = pht('Obsolete Config');
37 $name = pht('Obsolete Configuration Option "%s"', $key);
38 } else {
39 $summary = pht('This option is not recognized. It may be misspelled.');
40 $message = pht(
41 'The configuration option "%s" is not recognized. It may be '.
42 'misspelled, or it might have existed in an older version of '.
43 'the software. It has no effect, and should be corrected or deleted.',
44 $key);
45 $short = pht('Unknown Config');
46 $name = pht('Unknown Configuration Option "%s"', $key);
47 }
48
49 $issue = $this->newIssue('config.unknown.'.$key)
50 ->setShortName($short)
51 ->setName($name)
52 ->setSummary($summary);
53
54 $found = array();
55 $found_local = false;
56 $found_database = false;
57
58 foreach ($stack as $source_key => $source) {
59 $value = $source->getKeys(array($key));
60 if ($value) {
61 $found[] = $source->getName();
62 if ($source instanceof PhabricatorConfigDatabaseSource) {
63 $found_database = true;
64 }
65 if ($source instanceof PhabricatorConfigLocalSource) {
66 $found_local = true;
67 }
68 }
69 }
70
71 $message = $message."\n\n".pht(
72 'This configuration value is defined in these %d '.
73 'configuration source(s): %s.',
74 count($found),
75 implode(', ', $found));
76 $issue->setMessage($message);
77
78 if ($found_local) {
79 $command = hsprintf(
80 '<samp>%s $</samp><kbd>./bin/config delete %s</kbd>',
81 PlatformSymbols::getPlatformServerPath(),
82 $key);
83 $issue->addCommand($command);
84 }
85
86 if ($found_database) {
87 $issue->addPhabricatorConfig($key);
88
89 $command = hsprintf(
90 '<samp>%s $</samp><kbd>./bin/config delete --database %s</kbd>',
91 PlatformSymbols::getPlatformServerPath(),
92 $key);
93 $issue->addCommand($command);
94
95
96 }
97 }
98
99 $options = PhabricatorApplicationConfigOptions::loadAllOptions();
100 foreach ($defined_keys as $key => $value) {
101 $option = idx($options, $key);
102 if (!$option) {
103 continue;
104 }
105
106 if (!$option->getLocked()) {
107 continue;
108 }
109
110 $found_database = false;
111 foreach ($stack as $source_key => $source) {
112 $value = $source->getKeys(array($key));
113 if ($value) {
114 if ($source instanceof PhabricatorConfigDatabaseSource) {
115 $found_database = true;
116 break;
117 }
118 }
119 }
120
121 if (!$found_database) {
122 continue;
123 }
124
125 // NOTE: These are values which we don't let you edit directly, but edit
126 // via other UI workflows. For now, don't raise this warning about them.
127 // In the future, before we stop reading database configuration for
128 // locked values, we either need to add a flag which lets these values
129 // continue reading from the database or move them to some other storage
130 // mechanism.
131 $soft_locks = array(
132 'phabricator.uninstalled-applications',
133 'phabricator.application-settings',
134 'config.ignore-issues',
135 'auth.lock-config',
136 );
137 $soft_locks = array_fuse($soft_locks);
138 if (isset($soft_locks[$key])) {
139 continue;
140 }
141
142 $doc_name = 'Configuration Guide: Locked and Hidden Configuration';
143 $doc_href = PhabricatorEnv::getDoclink($doc_name);
144
145 $set_command = phutil_tag(
146 'tt',
147 array(),
148 csprintf(
149 'bin/config set %R <value>',
150 $key));
151
152 $summary = pht(
153 'Configuration value "%s" is locked, but has a value in the database.',
154 $key);
155 $message = pht(
156 'The configuration value "%s" is locked (so it can not be edited '.
157 'from the web UI), but has a database value. Usually, this means '.
158 'that it was previously not locked, you set it using the web UI, '.
159 'and it later became locked.'.
160 "\n\n".
161 'You should copy this configuration value to a local configuration '.
162 'source (usually by using %s) and then remove it from the database '.
163 'with the command below.'.
164 "\n\n".
165 'For more information on locked and hidden configuration, including '.
166 'details about this setup issue, see %s.'.
167 "\n\n".
168 'This database value is currently respected, but a future version '.
169 'of the software will stop respecting database values for locked '.
170 'configuration options.',
171 $key,
172 $set_command,
173 phutil_tag(
174 'a',
175 array(
176 'href' => $doc_href,
177 'target' => '_blank',
178 ),
179 $doc_name));
180 $command = hsprintf(
181 '<samp>%s $</samp><kbd>%s</kbd>',
182 PlatformSymbols::getPlatformServerPath(),
183 csprintf(
184 './bin/config delete --database %R',
185 $key));
186
187 $this->newIssue('config.locked.'.$key)
188 ->setShortName(pht('Deprecated Config Source'))
189 ->setName(
190 pht(
191 'Locked Configuration Option "%s" Has Database Value',
192 $key))
193 ->setSummary($summary)
194 ->setMessage($message)
195 ->addCommand($command)
196 ->addPhabricatorConfig($key);
197 }
198
199 if (PhabricatorEnv::getEnvConfig('feed.http-hooks')) {
200 $this->newIssue('config.deprecated.feed.http-hooks')
201 ->setShortName(pht('Feed Hooks Deprecated'))
202 ->setName(pht('Migrate From "feed.http-hooks" to Webhooks'))
203 ->addPhabricatorConfig('feed.http-hooks')
204 ->setMessage(
205 pht(
206 'The "feed.http-hooks" option is deprecated in favor of '.
207 'Webhooks. This option will be removed in a future version '.
208 'of the software.'.
209 "\n\n".
210 'You can configure Webhooks in Herald.'.
211 "\n\n".
212 'To resolve this issue, remove all URIs from "feed.http-hooks".'));
213 }
214
215 }
216
217 /**
218 * Return a map of deleted config options. Keys are option keys; values are
219 * explanations of what happened to the option.
220 */
221 public static function getAncientConfig() {
222 $reason_auth = pht(
223 'This option has been migrated to the "Auth" application. Your old '.
224 'configuration is still in effect, but now stored in "Auth" instead of '.
225 'configuration. Going forward, you can manage authentication from '.
226 'the web UI.');
227
228 $auth_config = array(
229 'controller.oauth-registration',
230 'auth.password-auth-enabled',
231 'facebook.auth-enabled',
232 'facebook.registration-enabled',
233 'facebook.auth-permanent',
234 'facebook.application-id',
235 'facebook.application-secret',
236 'facebook.require-https-auth',
237 'github.auth-enabled',
238 'github.registration-enabled',
239 'github.auth-permanent',
240 'github.application-id',
241 'github.application-secret',
242 'google.auth-enabled',
243 'google.registration-enabled',
244 'google.auth-permanent',
245 'google.application-id',
246 'google.application-secret',
247 'ldap.auth-enabled',
248 'ldap.hostname',
249 'ldap.port',
250 'ldap.base_dn',
251 'ldap.search_attribute',
252 'ldap.search-first',
253 'ldap.username-attribute',
254 'ldap.real_name_attributes',
255 'ldap.activedirectory_domain',
256 'ldap.version',
257 'ldap.referrals',
258 'ldap.anonymous-user-name',
259 'ldap.anonymous-user-password',
260 'ldap.start-tls',
261 'disqus.auth-enabled',
262 'disqus.registration-enabled',
263 'disqus.auth-permanent',
264 'disqus.application-id',
265 'disqus.application-secret',
266 'phabricator.oauth-uri',
267 'phabricator.auth-enabled',
268 'phabricator.registration-enabled',
269 'phabricator.auth-permanent',
270 'phabricator.application-id',
271 'phabricator.application-secret',
272 );
273
274 $ancient_config = array_fill_keys($auth_config, $reason_auth);
275
276 $markup_reason = pht(
277 'Custom remarkup rules are now added by subclassing '.
278 '%s or %s.',
279 'PhabricatorRemarkupCustomInlineRule',
280 'PhabricatorRemarkupCustomBlockRule');
281
282 $session_reason = pht(
283 'Sessions now expire and are garbage collected rather than having an '.
284 'arbitrary concurrency limit.');
285
286 $differential_field_reason = pht(
287 'All Differential fields are now managed through the configuration '.
288 'option "%s". Use that option to configure which fields are shown.',
289 'differential.fields');
290
291 $reply_domain_reason = pht(
292 'Individual application reply handler domains have been removed. '.
293 'Configure a reply domain with "%s".',
294 'metamta.reply-handler-domain');
295
296 $reply_handler_reason = pht(
297 'Reply handlers can no longer be overridden with configuration.');
298
299 $monospace_reason = pht(
300 'Global customization of monospaced fonts is no longer supported.');
301
302 $public_mail_reason = pht(
303 'Inbound mail addresses are now configured for each application '.
304 'in the Applications tool.');
305
306 $gc_reason = pht(
307 'Garbage collectors are now configured with "%s".',
308 'bin/garbage set-policy');
309
310 $aphlict_reason = pht(
311 'Configuration of the notification server has changed substantially. '.
312 'For discussion, see T10794.');
313
314 $stale_reason = pht(
315 'The Differential revision list view age UI elements have been removed '.
316 'to simplify the interface.');
317
318 $global_settings_reason = pht(
319 'The "Re: Prefix" and "Vary Subjects" settings are now configured '.
320 'in global settings.');
321
322 $dashboard_reason = pht(
323 'This option has been removed, you can use Dashboards to provide '.
324 'homepage customization. See T11533 for more details.');
325
326 $elastic_reason = pht(
327 'Elasticsearch is now configured with "%s".',
328 'cluster.search');
329
330 $mailers_reason = pht(
331 'Inbound and outbound mail is now configured with "cluster.mailers".');
332
333 $prefix_reason = pht(
334 'Per-application mail subject prefix customization is no longer '.
335 'directly supported. Prefixes and other strings may be customized with '.
336 '"translation.override".');
337
338 $phd_reason = pht(
339 'Use "bin/phd debug ..." to get a detailed daemon execution log.');
340
341 $ancient_config += array(
342 'phid.external-loaders' =>
343 pht(
344 'External loaders have been replaced. Extend `%s` '.
345 'to implement new PHID and handle types.',
346 'PhabricatorPHIDType'),
347 'maniphest.custom-task-extensions-class' =>
348 pht(
349 'Maniphest fields are now loaded automatically. '.
350 'You can configure them with `%s`.',
351 'maniphest.fields'),
352 'maniphest.custom-fields' =>
353 pht(
354 'Maniphest fields are now defined in `%s`. '.
355 'Existing definitions have been migrated.',
356 'maniphest.custom-field-definitions'),
357 'differential.custom-remarkup-rules' => $markup_reason,
358 'differential.custom-remarkup-block-rules' => $markup_reason,
359 'auth.sshkeys.enabled' => pht(
360 'SSH keys are now actually useful, so they are always enabled.'),
361 'differential.anonymous-access' => pht(
362 'Global access controls now exist, see `%s`.',
363 'policy.allow-public'),
364 'celerity.resource-path' => pht(
365 'An alternate resource map is no longer supported. Instead, use '.
366 'multiple maps. See T4222.'),
367 'metamta.send-immediately' => pht(
368 'Mail is now always delivered by the daemons.'),
369 'auth.sessions.conduit' => $session_reason,
370 'auth.sessions.web' => $session_reason,
371 'tokenizer.ondemand' => pht(
372 'Typeahead strategies are now managed automatically.'),
373 'differential.revision-custom-detail-renderer' => pht(
374 'Obsolete; use standard rendering events instead.'),
375 'differential.show-host-field' => $differential_field_reason,
376 'differential.show-test-plan-field' => $differential_field_reason,
377 'differential.field-selector' => $differential_field_reason,
378 'phabricator.show-beta-applications' => pht(
379 'This option has been renamed to `%s` to emphasize the '.
380 'unfinished nature of many prototype applications. '.
381 'Your existing setting has been migrated.',
382 'phabricator.show-prototypes'),
383 'notification.user' => pht(
384 'The notification server no longer requires root permissions. Start '.
385 'the server as the user you want it to run under.'),
386 'notification.debug' => pht(
387 'Notifications no longer have a dedicated debugging mode.'),
388 'translation.provider' => pht(
389 'The translation implementation has changed and providers are no '.
390 'longer used or supported.'),
391 'config.mask' => pht(
392 'Use `%s` instead of this option.',
393 'config.hide'),
394 'phd.start-taskmasters' => pht(
395 'Taskmasters now use an autoscaling pool. You can configure the '.
396 'pool size with `%s`.',
397 'phd.taskmasters'),
398 'storage.engine-selector' => pht(
399 'Storage engines are now discovered automatically at runtime.'),
400 'storage.upload-size-limit' => pht(
401 'Arbitrarily large files are now supported. Consult the '.
402 'documentation for configuration details.'),
403 'security.allow-outbound-http' => pht(
404 'This option has been replaced with the more granular option `%s`.',
405 'security.outbound-blacklist'),
406 'metamta.reply.show-hints' => pht(
407 'Reply hints are no longer shown in mail.'),
408
409 'metamta.differential.reply-handler-domain' => $reply_domain_reason,
410 'metamta.diffusion.reply-handler-domain' => $reply_domain_reason,
411 'metamta.macro.reply-handler-domain' => $reply_domain_reason,
412 'metamta.maniphest.reply-handler-domain' => $reply_domain_reason,
413 'metamta.pholio.reply-handler-domain' => $reply_domain_reason,
414
415 'metamta.diffusion.reply-handler' => $reply_handler_reason,
416 'metamta.differential.reply-handler' => $reply_handler_reason,
417 'metamta.maniphest.reply-handler' => $reply_handler_reason,
418 'metamta.package.reply-handler' => $reply_handler_reason,
419
420 'metamta.precedence-bulk' => pht(
421 'Transaction mail is now always sent with "Precedence: bulk" to '.
422 'improve deliverability.'),
423
424 'style.monospace' => $monospace_reason,
425 'style.monospace.windows' => $monospace_reason,
426
427 'search.engine-selector' => pht(
428 'Available search engines are now automatically discovered at '.
429 'runtime.'),
430
431 'metamta.files.public-create-email' => $public_mail_reason,
432 'metamta.maniphest.public-create-email' => $public_mail_reason,
433 'metamta.maniphest.default-public-author' => $public_mail_reason,
434 'metamta.paste.public-create-email' => $public_mail_reason,
435
436 'security.allow-conduit-act-as-user' => pht(
437 'Impersonating users over the API is no longer supported.'),
438
439 'feed.public' => pht('The framable public feed is no longer supported.'),
440
441 'auth.login-message' => pht(
442 'This configuration option has been replaced with a modular '.
443 'handler. See T9346.'),
444
445 'gcdaemon.ttl.herald-transcripts' => $gc_reason,
446 'gcdaemon.ttl.daemon-logs' => $gc_reason,
447 'gcdaemon.ttl.differential-parse-cache' => $gc_reason,
448 'gcdaemon.ttl.markup-cache' => $gc_reason,
449 'gcdaemon.ttl.task-archive' => $gc_reason,
450 'gcdaemon.ttl.general-cache' => $gc_reason,
451 'gcdaemon.ttl.conduit-logs' => $gc_reason,
452
453 'phd.variant-config' => pht(
454 'This configuration is no longer relevant because daemons '.
455 'restart automatically on configuration changes.'),
456
457 'notification.ssl-cert' => $aphlict_reason,
458 'notification.ssl-key' => $aphlict_reason,
459 'notification.pidfile' => $aphlict_reason,
460 'notification.log' => $aphlict_reason,
461 'notification.enabled' => $aphlict_reason,
462 'notification.client-uri' => $aphlict_reason,
463 'notification.server-uri' => $aphlict_reason,
464
465 'metamta.differential.unified-comment-context' => pht(
466 'Inline comments are now always rendered with a limited amount '.
467 'of context.'),
468
469 'differential.days-fresh' => $stale_reason,
470 'differential.days-stale' => $stale_reason,
471
472 'metamta.re-prefix' => $global_settings_reason,
473 'metamta.vary-subjects' => $global_settings_reason,
474
475 'ui.custom-header' => pht(
476 'This option has been replaced with `ui.logo`, which provides more '.
477 'flexible configuration options.'),
478
479 'welcome.html' => $dashboard_reason,
480 'maniphest.priorities.unbreak-now' => $dashboard_reason,
481 'maniphest.priorities.needs-triage' => $dashboard_reason,
482
483 'mysql.implementation' => pht(
484 'The best available MYSQL implementation is now selected '.
485 'automatically.'),
486
487 'mysql.configuration-provider' => pht(
488 'Partitioning and replication are now managed in primary '.
489 'configuration.'),
490
491 'search.elastic.host' => $elastic_reason,
492 'search.elastic.namespace' => $elastic_reason,
493
494 'metamta.mail-adapter' => $mailers_reason,
495 'amazon-ses.access-key' => $mailers_reason,
496 'amazon-ses.secret-key' => $mailers_reason,
497 'amazon-ses.endpoint' => $mailers_reason,
498 'mailgun.domain' => $mailers_reason,
499 'mailgun.api-key' => $mailers_reason,
500 'phpmailer.mailer' => $mailers_reason,
501 'phpmailer.smtp-host' => $mailers_reason,
502 'phpmailer.smtp-port' => $mailers_reason,
503 'phpmailer.smtp-protocol' => $mailers_reason,
504 'phpmailer.smtp-user' => $mailers_reason,
505 'phpmailer.smtp-password' => $mailers_reason,
506 'phpmailer.smtp-encoding' => $mailers_reason,
507 'sendgrid.api-user' => $mailers_reason,
508 'sendgrid.api-key' => $mailers_reason,
509
510 'celerity.resource-hash' => pht(
511 'This option generally did not prove useful. Resource hash keys '.
512 'are now managed automatically.'),
513 'celerity.enable-deflate' => pht(
514 'Resource deflation is now managed automatically.'),
515 'celerity.minify' => pht(
516 'Resource minification is now managed automatically.'),
517
518 'metamta.domain' => pht(
519 'Mail thread IDs are now generated automatically.'),
520 'metamta.placeholder-to-recipient' => pht(
521 'Placeholder recipients are now generated automatically.'),
522
523 'metamta.mail-key' => pht(
524 'Mail object address hash keys are now generated automatically.'),
525
526 'phabricator.csrf-key' => pht(
527 'CSRF HMAC keys are now managed automatically.'),
528
529 'metamta.insecure-auth-with-reply-to' => pht(
530 'Authenticating users based on "Reply-To" is no longer supported.'),
531
532 'phabricator.allow-email-users' => pht(
533 'Public email is now accepted if the associated address has a '.
534 'default author, and rejected otherwise.'),
535
536 'metamta.conpherence.subject-prefix' => $prefix_reason,
537 'metamta.differential.subject-prefix' => $prefix_reason,
538 'metamta.diffusion.subject-prefix' => $prefix_reason,
539 'metamta.files.subject-prefix' => $prefix_reason,
540 'metamta.legalpad.subject-prefix' => $prefix_reason,
541 'metamta.macro.subject-prefix' => $prefix_reason,
542 'metamta.maniphest.subject-prefix' => $prefix_reason,
543 'metamta.package.subject-prefix' => $prefix_reason,
544 'metamta.paste.subject-prefix' => $prefix_reason,
545 'metamta.pholio.subject-prefix' => $prefix_reason,
546 'metamta.phriction.subject-prefix' => $prefix_reason,
547
548 'aphront.default-application-configuration-class' => pht(
549 'This ancient extension point has been replaced with other '.
550 'mechanisms, including "AphrontSite".'),
551
552 'differential.whitespace-matters' => pht(
553 'Whitespace rendering is now handled automatically.'),
554
555 'phd.pid-directory' => pht(
556 'Daemons no longer use PID files.'),
557
558 'phd.trace' => $phd_reason,
559 'phd.verbose' => $phd_reason,
560 );
561
562 return $ancient_config;
563 }
564
565}