mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 06:42:42 +01:00
Add explicit mysql.port
configuration
See: https://github.com/facebook/phabricator/pull/356 Reviewed by: epriestley
This commit is contained in:
parent
a0084bbb0d
commit
d27e7c52b2
7 changed files with 28 additions and 3 deletions
|
@ -170,11 +170,12 @@ return array(
|
|||
// The password to use when connecting to MySQL.
|
||||
'mysql.pass' => '',
|
||||
|
||||
// The MySQL server to connect to. If you want to connect to a different
|
||||
// port than the default (which is 3306), specify it in the hostname
|
||||
// (e.g., db.example.com:1234).
|
||||
// The MySQL server to connect to.
|
||||
'mysql.host' => 'localhost',
|
||||
|
||||
// If you want to connect to a different port than the default (which is 3306)
|
||||
'mysql.port' => '3306',
|
||||
|
||||
// Phabricator supports PHP extensions MySQL and MySQLi. It is possible to
|
||||
// implement also other access mechanism (e.g. PDO_MySQL). The class must
|
||||
// extend AphrontMySQLDatabaseConnectionBase.
|
||||
|
|
|
@ -25,6 +25,7 @@ $conf = PhabricatorEnv::newObjectFromConfig(
|
|||
|
||||
$default_user = $conf->getUser();
|
||||
$default_host = $conf->getHost();
|
||||
$default_port = $conf->getPort();
|
||||
$default_namespace = PhabricatorLiskDAO::getDefaultStorageNamespace();
|
||||
|
||||
try {
|
||||
|
@ -82,6 +83,7 @@ $api = new PhabricatorStorageManagementAPI();
|
|||
$api->setUser($args->getArg('user'));
|
||||
PhabricatorEnv::overrideConfig('mysql.user', $args->getArg('user'));
|
||||
$api->setHost($default_host);
|
||||
$api->setPort($default_port);
|
||||
$api->setPassword($password);
|
||||
$api->setNamespace($args->getArg('namespace'));
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.")),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue