1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 21:20:24 +02:00

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 da6f79b34a
commit bccc970231

View File

@@ -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:'),