From e3a5e7eb8d546ab129cb70bb5e17e053786751ef Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sat, 22 Jul 2017 11:32:07 +0930 Subject: [PATCH] Remove MySQL port field from visual installer Port can still be specified by suffixing the host with a : closes #825 --- .../core/src/Install/Console/UserDataProvider.php | 3 +-- .../core/src/Install/Controller/InstallController.php | 11 +++++++++-- framework/core/views/install/install.php | 5 ----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/framework/core/src/Install/Console/UserDataProvider.php b/framework/core/src/Install/Console/UserDataProvider.php index 0bfac07bd..529e9d8e8 100644 --- a/framework/core/src/Install/Console/UserDataProvider.php +++ b/framework/core/src/Install/Console/UserDataProvider.php @@ -36,11 +36,10 @@ class UserDataProvider implements DataProviderInterface public function getDatabaseConfiguration() { $host = $this->ask('Database host:'); + $port = '3306'; if (str_contains($host, ':')) { list($host, $port) = explode(':', $host, 2); - } else { - $port = $this->ask('Database port:'); } return [ diff --git a/framework/core/src/Install/Controller/InstallController.php b/framework/core/src/Install/Controller/InstallController.php index e8bc7fec1..5cee7d10f 100644 --- a/framework/core/src/Install/Controller/InstallController.php +++ b/framework/core/src/Install/Controller/InstallController.php @@ -52,14 +52,21 @@ class InstallController implements ControllerInterface $data = new DefaultsDataProvider; + $host = array_get($input, 'mysqlHost'); + $port = '3306'; + + if (str_contains($host, ':')) { + list($host, $port) = explode(':', $host, 2); + } + $data->setDatabaseConfiguration([ 'driver' => 'mysql', - 'host' => array_get($input, 'mysqlHost'), + 'host' => $host, 'database' => array_get($input, 'mysqlDatabase'), 'username' => array_get($input, 'mysqlUsername'), 'password' => array_get($input, 'mysqlPassword'), 'prefix' => array_get($input, 'tablePrefix'), - 'port' => array_get($input, 'mysqlPort'), + 'port' => $port, ]); $data->setAdminUser([ diff --git a/framework/core/views/install/install.php b/framework/core/views/install/install.php index aae8128c8..5d53cd021 100644 --- a/framework/core/views/install/install.php +++ b/framework/core/views/install/install.php @@ -33,11 +33,6 @@ -
- - -
-