1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01:00

Improve STRICT_ALL_TABLES warning

Summary:
  - Make the warning describe rationale and point at the MySQL manual explicitly.
  - Add a reference to the developer mode config, in case the user wants to resolve the probelm by disabling developer mode.
  - Now that the message is huge, provide a summary.
  - Move from "Database" to "MySQL" setup checks -- this is kind of arbitrary, but the former is used for fatals (pre-install) and the latter for warnings (post-install) right now. This has no practical impact on anything and is purely stylistic.

Test Plan:
{F31798}

{F31799}

Reviewers: edward, blc

Reviewed By: edward

CC: aran

Differential Revision: https://secure.phabricator.com/D4835
This commit is contained in:
epriestley 2013-02-06 13:37:31 -08:00
parent 84efcb8669
commit e518135dfb
2 changed files with 25 additions and 14 deletions

View file

@ -65,20 +65,6 @@ final class PhabricatorSetupCheckDatabase extends PhabricatorSetupCheck {
return;
}
if (PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) {
$mode_string = queryfx_one($conn_raw, "SELECT @@sql_mode");
$modes = explode(',', $mode_string['@@sql_mode']);
if (!in_array('STRICT_ALL_TABLES', $modes)) {
$message = pht(
"The global sql_mode is not set to 'STRICT_ALL_TABLES'. It is ".
"recommended that you set this mode while developing Phabricator.");
$this->newIssue('mysql.mode')
->setName(pht('MySQL STRICT_ALL_TABLES mode not set.'))
->setMessage($message);
}
}
$namespace = PhabricatorEnv::getEnvConfig('storage.default-namespace');
$databases = queryfx_all($conn_raw, 'SHOW DATABASES');

View file

@ -24,6 +24,31 @@ final class PhabricatorSetupCheckMySQL extends PhabricatorSetupCheck {
->setName(pht('Small MySQL "max_allowed_packet"'))
->setMessage($message);
}
if (PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) {
$mode_string = queryfx_one($conn_raw, "SELECT @@sql_mode");
$modes = explode(',', $mode_string['@@sql_mode']);
if (!in_array('STRICT_ALL_TABLES', $modes)) {
$summary = pht(
"MySQL is not in strict mode, but should be for Phabricator ".
"development.");
$message = pht(
"This install is in developer mode, but the global sql_mode is not ".
"set to 'STRICT_ALL_TABLES'. It is recommended that you set this ".
"mode while developing Phabricator. Strict mode will promote some ".
"query warnings to errors, and ensure you don't miss them during ".
"development. You can find more information about this mode (and ".
"how to configure it) in the MySQL manual.");
$this->newIssue('mysql.mode')
->setName(pht('MySQL STRICT_ALL_TABLES Mode Not Set'))
->addPhabricatorConfig('phabricator.developer-mode')
->setSummary($summary)
->setMessage($message);
}
}
}
}