2013-01-01 23:09:17 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorSetupCheckExtraConfig extends PhabricatorSetupCheck {
|
|
|
|
|
|
|
|
protected function executeChecks() {
|
2013-06-26 20:01:19 +02:00
|
|
|
$ancient_config = self::getAncientConfig();
|
|
|
|
|
2013-01-01 23:09:17 +01:00
|
|
|
$all_keys = PhabricatorEnv::getAllConfigKeys();
|
|
|
|
$all_keys = array_keys($all_keys);
|
|
|
|
sort($all_keys);
|
|
|
|
|
|
|
|
$defined_keys = PhabricatorApplicationConfigOptions::loadAllOptions();
|
|
|
|
|
|
|
|
foreach ($all_keys as $key) {
|
|
|
|
if (isset($defined_keys[$key])) {
|
|
|
|
continue;
|
|
|
|
}
|
2013-06-26 20:01:19 +02:00
|
|
|
|
|
|
|
if (isset($ancient_config[$key])) {
|
|
|
|
$summary = pht(
|
|
|
|
'This option has been removed. You may delete it at your '.
|
|
|
|
'convenience.');
|
|
|
|
$message = pht(
|
|
|
|
"The configuration option '%s' has been removed. You may delete ".
|
|
|
|
"it at your convenience.".
|
|
|
|
"\n\n%s",
|
|
|
|
$key,
|
|
|
|
$ancient_config[$key]);
|
|
|
|
$short = pht('Obsolete Config');
|
|
|
|
$name = pht('Obsolete Configuration Option "%s"', $key);
|
|
|
|
} else {
|
2014-06-09 20:36:49 +02:00
|
|
|
$summary = pht('This option is not recognized. It may be misspelled.');
|
2013-06-26 20:01:19 +02:00
|
|
|
$message = pht(
|
|
|
|
"The configuration option '%s' is not recognized. It may be ".
|
|
|
|
"misspelled, or it might have existed in an older version of ".
|
|
|
|
"Phabricator. It has no effect, and should be corrected or deleted.",
|
|
|
|
$key);
|
|
|
|
$short = pht('Unknown Config');
|
|
|
|
$name = pht('Unknown Configuration Option "%s"', $key);
|
|
|
|
}
|
|
|
|
|
|
|
|
$issue = $this->newIssue('config.unknown.'.$key)
|
|
|
|
->setShortName($short)
|
|
|
|
->setName($name)
|
|
|
|
->setSummary($summary);
|
|
|
|
|
|
|
|
$stack = PhabricatorEnv::getConfigSourceStack();
|
|
|
|
$stack = $stack->getStack();
|
|
|
|
|
|
|
|
$found = array();
|
|
|
|
$found_local = false;
|
|
|
|
$found_database = false;
|
|
|
|
|
|
|
|
foreach ($stack as $source_key => $source) {
|
|
|
|
$value = $source->getKeys(array($key));
|
|
|
|
if ($value) {
|
|
|
|
$found[] = $source->getName();
|
|
|
|
if ($source instanceof PhabricatorConfigDatabaseSource) {
|
|
|
|
$found_database = true;
|
|
|
|
}
|
|
|
|
if ($source instanceof PhabricatorConfigLocalSource) {
|
|
|
|
$found_local = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$message = $message."\n\n".pht(
|
2014-06-09 20:36:49 +02:00
|
|
|
'This configuration value is defined in these %d '.
|
|
|
|
'configuration source(s): %s.',
|
2013-06-26 20:01:19 +02:00
|
|
|
count($found),
|
|
|
|
implode(', ', $found));
|
|
|
|
$issue->setMessage($message);
|
|
|
|
|
|
|
|
if ($found_local) {
|
|
|
|
$command = csprintf('phabricator/ $ ./bin/config delete %s', $key);
|
|
|
|
$issue->addCommand($command);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($found_database) {
|
|
|
|
$issue->addPhabricatorConfig($key);
|
|
|
|
}
|
2013-01-01 23:09:17 +01:00
|
|
|
}
|
|
|
|
}
|
2013-06-26 20:01:19 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a map of deleted config options. Keys are option keys; values are
|
|
|
|
* explanations of what happened to the option.
|
|
|
|
*/
|
|
|
|
public static function getAncientConfig() {
|
|
|
|
$reason_auth = pht(
|
|
|
|
'This option has been migrated to the "Auth" application. Your old '.
|
|
|
|
'configuration is still in effect, but now stored in "Auth" instead of '.
|
|
|
|
'configuration. Going forward, you can manage authentication from '.
|
|
|
|
'the web UI.');
|
|
|
|
|
|
|
|
$auth_config = array(
|
|
|
|
'controller.oauth-registration',
|
|
|
|
'auth.password-auth-enabled',
|
|
|
|
'facebook.auth-enabled',
|
|
|
|
'facebook.registration-enabled',
|
|
|
|
'facebook.auth-permanent',
|
|
|
|
'facebook.application-id',
|
|
|
|
'facebook.application-secret',
|
|
|
|
'facebook.require-https-auth',
|
|
|
|
'github.auth-enabled',
|
|
|
|
'github.registration-enabled',
|
|
|
|
'github.auth-permanent',
|
|
|
|
'github.application-id',
|
|
|
|
'github.application-secret',
|
|
|
|
'google.auth-enabled',
|
|
|
|
'google.registration-enabled',
|
|
|
|
'google.auth-permanent',
|
|
|
|
'google.application-id',
|
|
|
|
'google.application-secret',
|
|
|
|
'ldap.auth-enabled',
|
|
|
|
'ldap.hostname',
|
|
|
|
'ldap.port',
|
|
|
|
'ldap.base_dn',
|
|
|
|
'ldap.search_attribute',
|
|
|
|
'ldap.search-first',
|
|
|
|
'ldap.username-attribute',
|
|
|
|
'ldap.real_name_attributes',
|
|
|
|
'ldap.activedirectory_domain',
|
|
|
|
'ldap.version',
|
|
|
|
'ldap.referrals',
|
|
|
|
'ldap.anonymous-user-name',
|
|
|
|
'ldap.anonymous-user-password',
|
|
|
|
'ldap.start-tls',
|
|
|
|
'disqus.auth-enabled',
|
|
|
|
'disqus.registration-enabled',
|
|
|
|
'disqus.auth-permanent',
|
|
|
|
'disqus.application-id',
|
|
|
|
'disqus.application-secret',
|
|
|
|
'phabricator.oauth-uri',
|
|
|
|
'phabricator.auth-enabled',
|
|
|
|
'phabricator.registration-enabled',
|
|
|
|
'phabricator.auth-permanent',
|
|
|
|
'phabricator.application-id',
|
|
|
|
'phabricator.application-secret',
|
|
|
|
);
|
|
|
|
|
|
|
|
$ancient_config = array_fill_keys($auth_config, $reason_auth);
|
|
|
|
|
2013-10-25 02:26:07 +02:00
|
|
|
$markup_reason = pht(
|
|
|
|
'Custom remarkup rules are now added by subclassing '.
|
|
|
|
'PhabricatorRemarkupCustomInlineRule or '.
|
|
|
|
'PhabricatorRemarkupCustomBlockRule.');
|
|
|
|
|
2014-01-16 02:27:59 +01:00
|
|
|
$session_reason = pht(
|
|
|
|
'Sessions now expire and are garbage collected rather than having an '.
|
|
|
|
'arbitrary concurrency limit.');
|
|
|
|
|
2014-03-09 18:24:54 +01:00
|
|
|
$differential_field_reason = pht(
|
|
|
|
'All Differential fields are now managed through the configuration '.
|
|
|
|
'option "%s". Use that option to configure which fields are shown.',
|
|
|
|
'differential.fields');
|
|
|
|
|
2013-07-21 15:34:21 +02:00
|
|
|
$ancient_config += array(
|
|
|
|
'phid.external-loaders' =>
|
|
|
|
pht(
|
|
|
|
'External loaders have been replaced. Extend `PhabricatorPHIDType` '.
|
|
|
|
'to implement new PHID and handle types.'),
|
2013-09-17 00:58:35 +02:00
|
|
|
'maniphest.custom-task-extensions-class' =>
|
|
|
|
pht(
|
|
|
|
'Maniphest fields are now loaded automatically. You can configure '.
|
|
|
|
'them with `maniphest.fields`.'),
|
2013-09-19 20:56:15 +02:00
|
|
|
'maniphest.custom-fields' =>
|
|
|
|
pht(
|
|
|
|
'Maniphest fields are now defined in '.
|
|
|
|
'`maniphest.custom-field-definitions`. Existing definitions have '.
|
|
|
|
'been migrated.'),
|
2013-10-25 02:26:07 +02:00
|
|
|
'differential.custom-remarkup-rules' => $markup_reason,
|
|
|
|
'differential.custom-remarkup-block-rules' => $markup_reason,
|
2013-10-26 23:32:47 +02:00
|
|
|
'auth.sshkeys.enabled' => pht(
|
|
|
|
'SSH keys are now actually useful, so they are always enabled.'),
|
2013-11-12 01:05:19 +01:00
|
|
|
'differential.anonymous-access' => pht(
|
|
|
|
'Phabricator now has meaningful global access controls. See '.
|
|
|
|
'`policy.allow-public`.'),
|
2014-01-01 03:02:35 +01:00
|
|
|
'celerity.resource-path' => pht(
|
|
|
|
'An alternate resource map is no longer supported. Instead, use '.
|
|
|
|
'multiple maps. See T4222.'),
|
2014-01-14 22:22:47 +01:00
|
|
|
'metamta.send-immediately' => pht(
|
|
|
|
'Mail is now always delivered by the daemons.'),
|
2014-01-16 02:27:59 +01:00
|
|
|
'auth.sessions.conduit' => $session_reason,
|
|
|
|
'auth.sessions.web' => $session_reason,
|
Remove `tokenizer.ondemand`, and always load on demand
Summary:
Ref T4420. Tokenizers currently operate in "preload" or "ondemand" modes. In the former mode, which is default, they'll try to load the entire result list when a page loads.
The theory here was that this would slightly improve the experience for small installs, and once they got big enough they could switch to "ondemand". In practice, several issues have arisen:
- We generally don't have a good mechanism for telling installs that they should tweak perf config -- `metamta.send-immediately` is the canonical example here. Some large installs are probably affected negatively by not knowing to change this setting, and having settings like this is generally annoying.
- We have way way too much config now.
- With the advent of ApplicationSearch, pages like Maniphest make many redundant loads to prefill sources like projects. Most of the time, this data is not used. It's far simpler to switch everything to ondemand than try to deal with this, and dealing with this would mean creating two very complex divergent pathways in the codebase for a mostly theoretical performance benefit which only impacts tiny installs.
- We've been using `tokenizer.ondemand` forever on `secure.phabricator.com` since we have many thousands of user accounts, and it doesn't seem sluggish and works properly.
Removing this config is an easy fix which makes the codebase simpler.
I've retained the ability to use preloaded sources, since they may make sense in some cases (in at least one case -- task priorities -- adding a static source pathway might make sense), and they're part of Javelin itself. However, the code will no longer ever go down that pathway.
Test Plan: Used `secure.phabricator.com` for years with this setting enabled.
Reviewers: btrahan, chad
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T4420
Differential Revision: https://secure.phabricator.com/D8232
2014-02-14 19:24:40 +01:00
|
|
|
'tokenizer.ondemand' => pht(
|
|
|
|
'Phabricator now manages typeahead strategies automatically.'),
|
2014-02-27 20:06:14 +01:00
|
|
|
'differential.revision-custom-detail-renderer' => pht(
|
|
|
|
'Obsolete; use standard rendering events instead.'),
|
2014-03-09 18:24:54 +01:00
|
|
|
'differential.show-host-field' => $differential_field_reason,
|
|
|
|
'differential.show-test-plan-field' => $differential_field_reason,
|
2014-03-09 20:43:07 +01:00
|
|
|
'differential.field-selector' => $differential_field_reason,
|
2013-07-21 15:34:21 +02:00
|
|
|
);
|
|
|
|
|
2013-06-26 20:01:19 +02:00
|
|
|
return $ancient_config;
|
|
|
|
}
|
2013-01-01 23:09:17 +01:00
|
|
|
}
|