diff --git a/modules/Installer/Http/Controllers/InstallerController.php b/modules/Installer/Http/Controllers/InstallerController.php index 0ea63535..57fdd1d7 100644 --- a/modules/Installer/Http/Controllers/InstallerController.php +++ b/modules/Installer/Http/Controllers/InstallerController.php @@ -159,13 +159,17 @@ class InstallerController extends Controller public function envsetup(Request $request) { $log_str = $request->post(); - $log_str['password'] = ''; + $log_str['db_pass'] = ''; + Log::info('ENV setup', $log_str); // Before writing out the env file, test the DB credentials try { $this->testDb($request); } catch (\Exception $e) { + Log::error('Testing db before writing configs failed'); + Log::error($e->getMessage()); + flash()->error($e->getMessage()); return redirect(route('installer.step2'))->withInput(); } @@ -191,6 +195,9 @@ class InstallerController extends Controller try { $this->envService->createConfigFiles($attrs); } catch(FileException $e) { + Log::error('Config files failed to write'); + Log::error($e->getMessage()); + flash()->error($e->getMessage()); return redirect(route('installer.step2'))->withInput(); } @@ -213,6 +220,8 @@ class InstallerController extends Controller $console_out .= $this->dbService->setupDB(); $console_out .= $this->migrationSvc->runAllMigrations(); } catch(QueryException $e) { + Log::error('Error on db setup: ' . $e->getMessage()); + $this->envService->removeConfigFiles(); flash()->error($e->getMessage()); return redirect(route('installer.step2'))->withInput(); diff --git a/modules/Installer/Resources/views/install/steps/step2-db.blade.php b/modules/Installer/Resources/views/install/steps/step2-db.blade.php index 8cd10249..04deaee8 100644 --- a/modules/Installer/Resources/views/install/steps/step2-db.blade.php +++ b/modules/Installer/Resources/views/install/steps/step2-db.blade.php @@ -45,10 +45,7 @@ Database Host
- {!! Form::text('db_host', null, [ - 'class' => 'form-control', - 'placeholder' => 'localhost', - ]) !!} + {!! Form::input('text', 'db_host', '127.0.0.1', ['class' => 'form-control']) !!}
diff --git a/modules/Installer/Services/ConfigService.php b/modules/Installer/Services/ConfigService.php index ac389101..35d52fae 100644 --- a/modules/Installer/Services/ConfigService.php +++ b/modules/Installer/Services/ConfigService.php @@ -2,10 +2,10 @@ namespace Modules\Installer\Services; -use Log; -use PDO; -use Nwidart\Modules\Support\Stub; use Illuminate\Encryption\Encrypter; +use Log; +use Nwidart\Modules\Support\Stub; +use PDO; use Symfony\Component\HttpFoundation\File\Exception\FileException; /** diff --git a/modules/Installer/Services/DatabaseService.php b/modules/Installer/Services/DatabaseService.php index af78afde..4ecc3f21 100644 --- a/modules/Installer/Services/DatabaseService.php +++ b/modules/Installer/Services/DatabaseService.php @@ -9,12 +9,17 @@ class DatabaseService { /** * Check the PHP version that it meets the minimum requirement - * @throws \PDOException + * @param $driver + * @param $host + * @param $port + * @param $name + * @param $user + * @param $pass * @return boolean */ public function checkDbConnection($driver, $host, $port, $name, $user, $pass) { - Log::info('Testing Connection: '.$driver.'::'.$user.':'.$pass.'@'.$host.':'.$port.';'.$name); + Log::info('Testing Connection: '.$driver.'::'.$user.':@'.$host.':'.$port.';'.$name); if($driver === 'mysql') { $dsn = "mysql:host=$host;port=$port;dbname=$name";