From 39afb3fedb72312d22d076a589c609dbb93a3b68 Mon Sep 17 00:00:00 2001 From: Bryan Cuccioli Date: Mon, 4 Feb 2013 09:03:19 -0800 Subject: [PATCH] Suggest STRICT_ALL_TABLES during setup. Improve dev-mode comments. Summary: Suggest the MySQL mode STRICT_ALL_TABLES during setup if it is not set. Small improvement to the phabricator.developer-mode comments. Test Plan: Set the global sql_mode to include or exclude STRICT_ALL_TABLES and check for desired behavior. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4803 --- conf/default.conf.php | 3 ++- .../config/check/PhabricatorSetupCheckDatabase.php | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/conf/default.conf.php b/conf/default.conf.php index a9e4cff5a1..26f76dd3ce 100644 --- a/conf/default.conf.php +++ b/conf/default.conf.php @@ -801,7 +801,8 @@ return array( // Show stack traces when unhandled exceptions occur, force reloading of // static resources (skipping the cache), show an error callout if a page // generated PHP errors, warnings, or notices, force disk reads when - // reloading. This option should not be enabled in production. + // reloading, and generally make development easier. This option should not + // be enabled in production. 'phabricator.developer-mode' => false, // When users write comments which have URIs, they'll be automatically linked diff --git a/src/applications/config/check/PhabricatorSetupCheckDatabase.php b/src/applications/config/check/PhabricatorSetupCheckDatabase.php index adef6a7cc1..67ce6bc94c 100644 --- a/src/applications/config/check/PhabricatorSetupCheckDatabase.php +++ b/src/applications/config/check/PhabricatorSetupCheckDatabase.php @@ -65,6 +65,20 @@ 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');