From bccc970231776685f8384452b71596db3605fc5e Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Fri, 3 Feb 2017 18:15:52 +0100 Subject: [PATCH] Try to extract port from host when installing in console The very last suggestion broght up in pull request #989. --- src/Install/Console/UserDataProvider.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Install/Console/UserDataProvider.php b/src/Install/Console/UserDataProvider.php index e5805e9ba..0bfac07bd 100644 --- a/src/Install/Console/UserDataProvider.php +++ b/src/Install/Console/UserDataProvider.php @@ -35,10 +35,18 @@ class UserDataProvider implements DataProviderInterface public function getDatabaseConfiguration() { + $host = $this->ask('Database host:'); + + if (str_contains($host, ':')) { + list($host, $port) = explode(':', $host, 2); + } else { + $port = $this->ask('Database port:'); + } + return [ 'driver' => 'mysql', - 'host' => $this->ask('Database host:'), - 'port' => $this->ask('Database port:'), + 'host' => $host, + 'port' => $port, 'database' => $this->ask('Database name:'), 'username' => $this->ask('Database user:'), 'password' => $this->secret('Database password:'),