Use DatabaseConfigurationProvider to get DB info

Summary:
remove accessing the db config info directly. Use
DatabaseConfigurationProvider instead. Also fixed a minor issue where
different number of newlines are output in PhabricatorSetup.php's output.

Test Plan:
executed upgrade_schema.php; executed PhabricatorSetup.php by
setting 'phabricator.setup' to true.

Reviewed By: epriestley
Reviewers: epriestley
CC: aran, jungejason, epriestley
Differential Revision: 443
This commit is contained in:
Jason Ge
2011-06-11 15:11:50 -07:00
parent bb7e175dc2
commit f2efdd07a7
5 changed files with 31 additions and 10 deletions

View File

@@ -59,15 +59,16 @@ if (empty($options['f'])) {
// Use always the version from the commandline if it is defined
$next_version = isset($options['v']) ? (int)$options['v'] : null;
// TODO: Get this stuff from DatabaseConfigurationProvider?
$conf = DatabaseConfigurationProvider::getConfiguration();
if ($options['u']) {
$conn_user = $options['u'];
$conn_pass = $options['p'];
} else {
$conn_user = PhabricatorEnv::getEnvConfig('mysql.user');
$conn_pass = PhabricatorEnv::getEnvConfig('mysql.pass');
$conn_user = $conf->getUser();
$conn_pass = $conf->getPassword();
}
$conn_host = PhabricatorEnv::getEnvConfig('mysql.host');
$conn_host = $conf->getHost();
// Split out port information, since the command-line client requires a
// separate flag for the port.