Try to extract port from host when installing in console

The very last suggestion broght up in pull request #989.
This commit is contained in:
Franz Liedke 2017-02-03 18:15:52 +01:00
parent 4590b2cd30
commit 65535bf738

View File

@ -35,10 +35,18 @@ class UserDataProvider implements DataProviderInterface
public function getDatabaseConfiguration() 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 [ return [
'driver' => 'mysql', 'driver' => 'mysql',
'host' => $this->ask('Database host:'), 'host' => $host,
'port' => $this->ask('Database port:'), 'port' => $port,
'database' => $this->ask('Database name:'), 'database' => $this->ask('Database name:'),
'username' => $this->ask('Database user:'), 'username' => $this->ask('Database user:'),
'password' => $this->secret('Database password:'), 'password' => $this->secret('Database password:'),