From 5674cbd782e0bb19866536702a09059571ca6695 Mon Sep 17 00:00:00 2001 From: Levi Jackson Date: Fri, 5 Jul 2013 15:36:35 -0400 Subject: [PATCH 1/4] adding port config option for mysql --- .../config/check/PhabricatorSetupCheckDatabase.php | 2 ++ .../config/option/PhabricatorMySQLConfigOptions.php | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/applications/config/check/PhabricatorSetupCheckDatabase.php b/src/applications/config/check/PhabricatorSetupCheckDatabase.php index 3bf7b152dc..cec6e2c118 100644 --- a/src/applications/config/check/PhabricatorSetupCheckDatabase.php +++ b/src/applications/config/check/PhabricatorSetupCheckDatabase.php @@ -12,6 +12,7 @@ protected function executeChecks() { $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 @@ protected function executeChecks() { 'user' => $conn_user, 'pass' => $conn_pass, 'host' => $conn_host, + 'port' => $conn_port, 'database' => null, ); diff --git a/src/applications/config/option/PhabricatorMySQLConfigOptions.php b/src/applications/config/option/PhabricatorMySQLConfigOptions.php index 5165fe0a75..ce3ec0f1e8 100644 --- a/src/applications/config/option/PhabricatorMySQLConfigOptions.php +++ b/src/applications/config/option/PhabricatorMySQLConfigOptions.php @@ -69,6 +69,9 @@ public function getOptions() { "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', '3306') + ->setDescription( + pht("MySQL port to use when connecting to the database.")), ); } From d0ff04d15b3784ee8bfdf5e21c1f9045f4ecc0c2 Mon Sep 17 00:00:00 2001 From: Levi Jackson Date: Fri, 5 Jul 2013 16:42:33 -0400 Subject: [PATCH 2/4] adding port to other files it is utilized with --- .../DefaultDatabaseConfigurationProvider.php | 4 ++++ src/infrastructure/storage/lisk/PhabricatorLiskDAO.php | 1 + .../management/PhabricatorStorageManagementAPI.php | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/src/infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php b/src/infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php index fd62a2680a..839fa2816b 100644 --- a/src/infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php +++ b/src/infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php @@ -29,6 +29,10 @@ public function getHost() { return PhabricatorEnv::getEnvConfig('mysql.host'); } + public function getPort() { + return PhabricatorEnv::getEnvConfig('mysql.port'); + } + public function getDatabase() { if (!$this->getDao()) { return null; diff --git a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php index 0158d18b10..1e6ca35738 100644 --- a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php +++ b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php @@ -110,6 +110,7 @@ public function establishLiveConnection($mode) { 'user' => $conf->getUser(), 'pass' => $conf->getPassword(), 'host' => $conf->getHost(), + 'port' => $conf->getPort(), 'database' => $conf->getDatabase(), 'retries' => 3, ), diff --git a/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php b/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php index 2421d50a6e..a61ebd2c5b 100644 --- a/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php +++ b/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php @@ -45,6 +45,15 @@ public function getHost() { 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 @@ public function getConn($fragment) { 'user' => $this->user, 'pass' => $this->password, 'host' => $this->host, + 'port' => $this->port, 'database' => $fragment ? $database : null, From 04fec8e812d10cbd1985222d61da06e053669987 Mon Sep 17 00:00:00 2001 From: Levi Jackson Date: Mon, 8 Jul 2013 11:25:34 -0400 Subject: [PATCH 3/4] adding support for port parameter --- .../config/check/PhabricatorSetupCheckDatabase.php | 2 ++ .../config/option/PhabricatorMySQLConfigOptions.php | 3 +++ .../DefaultDatabaseConfigurationProvider.php | 4 ++++ src/infrastructure/storage/lisk/PhabricatorLiskDAO.php | 1 + .../management/PhabricatorStorageManagementAPI.php | 10 ++++++++++ 5 files changed, 20 insertions(+) diff --git a/src/applications/config/check/PhabricatorSetupCheckDatabase.php b/src/applications/config/check/PhabricatorSetupCheckDatabase.php index 3bf7b152dc..cec6e2c118 100644 --- a/src/applications/config/check/PhabricatorSetupCheckDatabase.php +++ b/src/applications/config/check/PhabricatorSetupCheckDatabase.php @@ -12,6 +12,7 @@ protected function executeChecks() { $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 @@ protected function executeChecks() { 'user' => $conn_user, 'pass' => $conn_pass, 'host' => $conn_host, + 'port' => $conn_port, 'database' => null, ); diff --git a/src/applications/config/option/PhabricatorMySQLConfigOptions.php b/src/applications/config/option/PhabricatorMySQLConfigOptions.php index 5165fe0a75..8674c32fc8 100644 --- a/src/applications/config/option/PhabricatorMySQLConfigOptions.php +++ b/src/applications/config/option/PhabricatorMySQLConfigOptions.php @@ -69,6 +69,9 @@ public function getOptions() { "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', '3306') + ->setDescription( + pht("MySQL port to use when connecting to the database.")), ); } diff --git a/src/infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php b/src/infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php index fd62a2680a..839fa2816b 100644 --- a/src/infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php +++ b/src/infrastructure/storage/configuration/DefaultDatabaseConfigurationProvider.php @@ -29,6 +29,10 @@ public function getHost() { return PhabricatorEnv::getEnvConfig('mysql.host'); } + public function getPort() { + return PhabricatorEnv::getEnvConfig('mysql.port'); + } + public function getDatabase() { if (!$this->getDao()) { return null; diff --git a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php index 0158d18b10..1e6ca35738 100644 --- a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php +++ b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php @@ -110,6 +110,7 @@ public function establishLiveConnection($mode) { 'user' => $conf->getUser(), 'pass' => $conf->getPassword(), 'host' => $conf->getHost(), + 'port' => $conf->getPort(), 'database' => $conf->getDatabase(), 'retries' => 3, ), diff --git a/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php b/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php index 2421d50a6e..747b2b9aec 100644 --- a/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php +++ b/src/infrastructure/storage/management/PhabricatorStorageManagementAPI.php @@ -3,6 +3,7 @@ final class PhabricatorStorageManagementAPI { private $host; + private $port; private $user; private $password; private $namespace; @@ -45,6 +46,15 @@ public function getHost() { 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; } From 14cc5cf10154bad9e03f3b92f16af787a4a7b429 Mon Sep 17 00:00:00 2001 From: Levi Jackson Date: Thu, 11 Jul 2013 19:23:17 -0400 Subject: [PATCH 4/4] updating mysql default port to null --- .../config/option/PhabricatorMySQLConfigOptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/config/option/PhabricatorMySQLConfigOptions.php b/src/applications/config/option/PhabricatorMySQLConfigOptions.php index 5dbc905d2d..e19348880b 100644 --- a/src/applications/config/option/PhabricatorMySQLConfigOptions.php +++ b/src/applications/config/option/PhabricatorMySQLConfigOptions.php @@ -69,7 +69,7 @@ public function getOptions() { "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', '3306') + $this->newOption('mysql.port', 'string', null) ->setLocked(true) ->setDescription( pht("MySQL port to use when connecting to the database.")),