diff --git a/modules/Installer/Http/Controllers/InstallerController.php b/modules/Installer/Http/Controllers/InstallerController.php index 6fedb849..9977cfbc 100644 --- a/modules/Installer/Http/Controllers/InstallerController.php +++ b/modules/Installer/Http/Controllers/InstallerController.php @@ -117,7 +117,7 @@ class InstallerController extends AppBaseController ); $log[] = 'Creating database'; - $console_out = $this->dbService->setupDB(); + $console_out = $this->dbService->setupDB($request->input('db_conn')); return view('installer::steps/step2a-completed', [ 'console_output' => $console_out diff --git a/modules/Installer/Services/DatabaseService.php b/modules/Installer/Services/DatabaseService.php index d97b2556..176e099f 100644 --- a/modules/Installer/Services/DatabaseService.php +++ b/modules/Installer/Services/DatabaseService.php @@ -12,11 +12,11 @@ class DatabaseService { * @throws \PDOException * @return boolean */ - public function checkDbConnection($type, $host, $port, $name, $user, $pass) + public function checkDbConnection($driver, $host, $port, $name, $user, $pass) { - Log::info('Testing Connection: '.$type.'::'.$user.':'.$pass.'@'.$host.':'.$port.';'.$name); + Log::info('Testing Connection: '.$driver.'::'.$user.':'.$pass.'@'.$host.':'.$port.';'.$name); - if($type === 'mysql') { + if($driver === 'mysql') { $dsn = "mysql:host=$host;port=$port;"; Log::info('Connection string: '. $dsn); try { @@ -27,7 +27,7 @@ class DatabaseService { } // Needs testing - elseif ($type === 'postgres') { + elseif ($driver === 'postgres') { $dsn = "pgsql:host=$host;port=$port;dbname=$name"; try { $conn = new PDO($dsn, $user, $pass); @@ -42,12 +42,14 @@ class DatabaseService { /** * Setup the database by running the migration commands */ - public function setupDB() + public function setupDB($db_driver='') { $output = ''; - #\Artisan::call('database:create'); - #$output .= \Artisan::output(); + if($db_driver === 'sqlite') { + \Artisan::call('database:create'); + $output .= \Artisan::output(); + } \Artisan::call('migrate'); $output .= trim(\Artisan::output()); diff --git a/modules/Installer/Services/EnvironmentService.php b/modules/Installer/Services/EnvironmentService.php index 7d905798..6780a2b3 100644 --- a/modules/Installer/Services/EnvironmentService.php +++ b/modules/Installer/Services/EnvironmentService.php @@ -11,12 +11,12 @@ class EnvironmentService * Create the .env file * @return boolean */ - public function createEnvFile($type, $host, $port, $name, $user, $pass) + public function createEnvFile($driver, $host, $port, $name, $user, $pass) { $opts = [ 'APP_ENV' => 'dev', 'APP_KEY' => $this->createAppKey(), - 'DB_CONN' => $type, + 'DB_CONN' => $driver, 'DB_HOST' => $host, 'DB_PORT' => $port, 'DB_NAME' => $name,