From 661ce426ddadc4053481152b8c7b1ae3a03a2592 Mon Sep 17 00:00:00 2001 From: FreeScout Date: Sun, 19 Jul 2020 02:22:19 -0700 Subject: [PATCH] Fix installation wizard with PostgreSQL - closes #654 --- .../Controllers/EnvironmentController.php | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/overrides/RachidLaasri/LaravelInstaller/Controllers/EnvironmentController.php b/overrides/RachidLaasri/LaravelInstaller/Controllers/EnvironmentController.php index 697f1831..30e1eb78 100644 --- a/overrides/RachidLaasri/LaravelInstaller/Controllers/EnvironmentController.php +++ b/overrides/RachidLaasri/LaravelInstaller/Controllers/EnvironmentController.php @@ -128,7 +128,7 @@ class EnvironmentController extends Controller $request->database_charset = 'utf8'; $request->database_collation = 'utf8_unicode_ci'; - $this->testDbConnect($request); + // $this->testDbConnect($request); } else { throw $e; } @@ -158,16 +158,25 @@ class EnvironmentController extends Controller public function testDbConnect($request, $params = []) { - $params = array_merge([ - 'driver' => 'mysql', + $driver = $request->database_connection ?? 'mysql'; + $config = config('database.connections.'.$driver); + if (!$config) { + $config = []; + } + + $params = array_merge($config, $params); + + $params = array_merge($params, [ + 'driver' => $driver, 'host' => $request->database_hostname, + 'port' => $request->database_port, 'database' => $request->database_name, 'username' => $request->database_username, 'password' => $request->database_password, - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', - ], $params); + // 'charset' => 'utf8mb4', + // 'collation' => 'utf8mb4_unicode_ci', + // 'prefix' => '', + ]); $params_hash = md5(json_encode($params)); \Config::set('database.connections.install'.$params_hash, $params);