1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Add a setup warning for probable misconfiguration of 'apc.stat'

Summary: Fixes T3501. `apc.stat` should generally be 0 in production and 1 in development. Raise a setup warning if it isn't.

Test Plan:
Hit both setup warnings.

{F49176}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3501

Differential Revision: https://secure.phabricator.com/D6376
This commit is contained in:
epriestley 2013-07-08 11:56:14 -07:00
parent 36f7ee5030
commit dd3f4fd267

View file

@ -31,7 +31,53 @@ final class PhabricatorSetupCheckAPC extends PhabricatorSetupCheck {
->setSummary($summary)
->setMessage($message)
->addPHPConfig('apc.enabled');
return;
}
$is_dev = PhabricatorEnv::getEnvConfig('phabricator.developer-mode');
$is_stat_enabled = ini_get('apc.stat');
$issue_key = null;
if ($is_stat_enabled && !$is_dev) {
$issue_key = 'extension.apc.stat-enabled';
$short = pht("'apc.stat' Enabled");
$long = pht("'apc.stat' Enabled in Production");
$summary = pht(
"'apc.stat' is currently enabled, but should probably be disabled.");
$message = pht(
"'apc.stat' is currently enabled in your PHP configuration. For most ".
"Phabricator installs, 'apc.stat' should be disabled. This will ".
"slightly improve performance (PHP will do fewer disk reads) and make ".
"updates safer (PHP won't read in the middle of a 'git pull').\n\n".
"(If you are developing for Phabricator, leave 'apc.stat' enabled but ".
"enable 'phabricator.developer-mode'.)");
} else if (!$is_stat_enabled && $is_dev) {
$issue_key = 'extension.apc.stat-disabled';
$short = pht("'apc.stat' Disabled");
$long = pht("'apc.stat' Disabled in Development");
$summary = pht(
"'apc.stat' is currently disabled, but should probably be enabled ".
"in development mode.");
$message = pht(
"'apc.stat' is disabled in your PHP configuration, but Phabricator is ".
"set to developer mode. Normally, you should enable 'apc.stat' for ".
"development installs so you don't need to restart your webserver ".
"after making changes to the code.\n\n".
"You can enable 'apc.stat', or disable 'phabricator.developer-mode', ".
"or safely ignore this warning if you have some reasonining behind ".
"your current configuration.");
}
if ($issue_key !== null) {
$this
->newIssue($issue_key)
->setShortName($short)
->setName($long)
->setSummary($summary)
->setMessage($message)
->addPHPConfig('apc.stat')
->addPhabricatorConfig('phabricator.developer-mode');
}
}
}