diff --git a/conf/default.conf.php b/conf/default.conf.php index bc427dcafb..cf9f963d4e 100644 --- a/conf/default.conf.php +++ b/conf/default.conf.php @@ -174,7 +174,7 @@ return array( 'mysql.host' => 'localhost', // If you want to connect to a different port than the default (which is 3306) - 'mysql.port' => '3306', + 'mysql.port' => null, // Phabricator supports PHP extensions MySQL and MySQLi. It is possible to // implement also other access mechanism (e.g. PDO_MySQL). The class must diff --git a/src/applications/config/check/PhabricatorSetupCheckDatabase.php b/src/applications/config/check/PhabricatorSetupCheckDatabase.php index b0903eabc2..24a2f26a7b 100644 --- a/src/applications/config/check/PhabricatorSetupCheckDatabase.php +++ b/src/applications/config/check/PhabricatorSetupCheckDatabase.php @@ -107,5 +107,36 @@ final class PhabricatorSetupCheckDatabase extends PhabricatorSetupCheck { hsprintf('phabricator/ $ ./bin/storage upgrade')); } } + + + $host = PhabricatorEnv::getEnvConfig('mysql.host'); + $matches = null; + if (preg_match('/^([^:]+):(\d+)$/', $host, $matches)) { + $host = $matches[1]; + $port = $matches[2]; + + $this->newIssue('storage.mysql.hostport') + ->setName(pht('Deprecated mysql.host Format')) + ->setSummary( + pht( + 'Move port information from `mysql.host` to `mysql.port` in your '. + 'config.')) + ->setMessage( + pht( + 'Your `mysql.host` configuration contains a port number, but '. + 'this usage is deprecated. Instead, put the port number in '. + '`mysql.port`.')) + ->addPhabricatorConfig('mysql.host') + ->addPhabricatorConfig('mysql.port') + ->addCommand( + hsprintf( + 'phabricator/ $ ./bin/config set mysql.host %s', + $host)) + ->addCommand( + hsprintf( + 'phabricator/ $ ./bin/config set mysql.port %s', + $port)); + } + } }