Skip to content

Commit 1b48e92

Browse files
author
epriestley
committedJul 14, 2013
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: - phacility/libphutil#27 - phacility#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
1 parent d27e7c5 commit 1b48e92

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed
 

‎conf/default.conf.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
'mysql.host' => 'localhost',
175175

176176
// If you want to connect to a different port than the default (which is 3306)
177-
'mysql.port' => '3306',
177+
'mysql.port' => null,
178178

179179
// Phabricator supports PHP extensions MySQL and MySQLi. It is possible to
180180
// implement also other access mechanism (e.g. PDO_MySQL). The class must

‎src/applications/config/check/PhabricatorSetupCheckDatabase.php

+31
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,36 @@ protected function executeChecks() {
107107
hsprintf('<tt>phabricator/ $</tt> ./bin/storage upgrade'));
108108
}
109109
}
110+
111+
112+
$host = PhabricatorEnv::getEnvConfig('mysql.host');
113+
$matches = null;
114+
if (preg_match('/^([^:]+):(\d+)$/', $host, $matches)) {
115+
$host = $matches[1];
116+
$port = $matches[2];
117+
118+
$this->newIssue('storage.mysql.hostport')
119+
->setName(pht('Deprecated mysql.host Format'))
120+
->setSummary(
121+
pht(
122+
'Move port information from `mysql.host` to `mysql.port` in your '.
123+
'config.'))
124+
->setMessage(
125+
pht(
126+
'Your `mysql.host` configuration contains a port number, but '.
127+
'this usage is deprecated. Instead, put the port number in '.
128+
'`mysql.port`.'))
129+
->addPhabricatorConfig('mysql.host')
130+
->addPhabricatorConfig('mysql.port')
131+
->addCommand(
132+
hsprintf(
133+
'<tt>phabricator/ $</tt> ./bin/config set mysql.host %s',
134+
$host))
135+
->addCommand(
136+
hsprintf(
137+
'<tt>phabricator/ $</tt> ./bin/config set mysql.port %s',
138+
$port));
139+
}
140+
110141
}
111142
}

0 commit comments

Comments
 (0)
Failed to load comments.