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