Add explicit mysql.port configuration

See: https://github.com/facebook/phabricator/pull/356

Reviewed by: epriestley
This commit is contained in:
Levi Jackson
2013-07-14 16:02:12 -07:00
committed by epriestley
parent a0084bbb0d
commit d27e7c52b2
7 changed files with 28 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ final class PhabricatorSetupCheckDatabase extends PhabricatorSetupCheck {
$conn_user = $conf->getUser();
$conn_pass = $conf->getPassword();
$conn_host = $conf->getHost();
$conn_port = $conf->getPort();
ini_set('mysql.connect_timeout', 2);
@@ -19,6 +20,7 @@ final class PhabricatorSetupCheckDatabase extends PhabricatorSetupCheck {
'user' => $conn_user,
'pass' => $conn_pass,
'host' => $conn_host,
'port' => $conn_port,
'database' => null,
);
@@ -40,6 +42,7 @@ final class PhabricatorSetupCheckDatabase extends PhabricatorSetupCheck {
->setMessage($message)
->setIsFatal(true)
->addRelatedPhabricatorConfig('mysql.host')
->addRelatedPhabricatorConfig('mysql.port')
->addRelatedPhabricatorConfig('mysql.user')
->addRelatedPhabricatorConfig('mysql.pass');
return;

View File

@@ -69,6 +69,10 @@ final class PhabricatorMySQLConfigOptions
"this namespace if you want. Normally, you should not do this ".
"unless you are developing Phabricator and using namespaces to ".
"separate multiple sandbox datasets.")),
$this->newOption('mysql.port', 'string', null)
->setLocked(true)
->setDescription(
pht("MySQL port to use when connecting to the database.")),
);
}

View File

@@ -29,6 +29,10 @@ final class DefaultDatabaseConfigurationProvider
return PhabricatorEnv::getEnvConfig('mysql.host');
}
public function getPort() {
return PhabricatorEnv::getEnvConfig('mysql.port');
}
public function getDatabase() {
if (!$this->getDao()) {
return null;

View File

@@ -110,6 +110,7 @@ abstract class PhabricatorLiskDAO extends LiskDAO {
'user' => $conf->getUser(),
'pass' => $conf->getPassword(),
'host' => $conf->getHost(),
'port' => $conf->getPort(),
'database' => $conf->getDatabase(),
'retries' => 3,
),

View File

@@ -45,6 +45,15 @@ final class PhabricatorStorageManagementAPI {
return $this->host;
}
public function setPort($port) {
$this->port = $port;
return $this;
}
public function getPort() {
return $this->port;
}
public function getDatabaseName($fragment) {
return $this->namespace.'_'.$fragment;
}
@@ -74,6 +83,7 @@ final class PhabricatorStorageManagementAPI {
'user' => $this->user,
'pass' => $this->password,
'host' => $this->host,
'port' => $this->port,
'database' => $fragment
? $database
: null,