1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-09 16:32:39 +01:00

Add a setup warning for port in mysql.host

Summary:
A pull from GitHub recently added `mysql.port`, for explicitly configuring the MySQL port. See:

  - https://github.com/facebook/libphutil/pull/27
  - https://github.com/facebook/phabricator/pull/356

Add a setup warning for old-style configurations (which will still work properly), to get them to move to the new style.

Test Plan: {F50113}

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D6449
This commit is contained in:
epriestley 2013-07-14 16:57:50 -07:00
parent d27e7c52b2
commit 1b48e922d4
2 changed files with 32 additions and 1 deletions

View file

@ -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

View file

@ -107,5 +107,36 @@ final class PhabricatorSetupCheckDatabase extends PhabricatorSetupCheck {
hsprintf('<tt>phabricator/ $</tt> ./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(
'<tt>phabricator/ $</tt> ./bin/config set mysql.host %s',
$host))
->addCommand(
hsprintf(
'<tt>phabricator/ $</tt> ./bin/config set mysql.port %s',
$port));
}
}
}