Replace importer with AJAX powered; better error handling #443 (#447)

* Replace importer with AJAX powered; better error handling #443

* Formatting

* Fix command line importer
This commit is contained in:
Nabeel S
2019-12-02 09:57:35 -05:00
committed by GitHub
parent 50dc79bc8d
commit 68eff40753
31 changed files with 544 additions and 354 deletions

View File

@@ -3,7 +3,8 @@
namespace Modules\Installer\Services;
use App\Contracts\Service;
use Log;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log;
use PDO;
class DatabaseService extends Service
@@ -24,19 +25,8 @@ class DatabaseService extends Service
{
Log::info('Testing Connection: '.$driver.'::'.$user.':<hidden>@'.$host.':'.$port.';'.$name);
if ($driver === 'mysql') {
$dsn = "mysql:host=$host;port=$port;dbname=$name";
Log::info('Connection string: '.$dsn);
try {
$conn = new PDO($dsn, $user, $pass);
} catch (\PDOException $e) {
throw $e;
}
}
// TODO: Needs testing
elseif ($driver === 'postgres') {
if ($driver === 'postgres') {
$dsn = "pgsql:host=$host;port=$port;dbname=$name";
try {
@@ -44,8 +34,19 @@ class DatabaseService extends Service
} catch (\PDOException $e) {
throw $e;
}
return true;
}
// Default MySQL
$dsn = "mysql:host=$host;port=$port;dbname=$name";
Log::info('Connection string: '.$dsn);
try {
$conn = new PDO($dsn, $user, $pass);
} catch (\PDOException $e) {
throw $e;
}
return true;
}
@@ -59,8 +60,8 @@ class DatabaseService extends Service
$output = '';
if (config('database.default') === 'sqlite') {
\Artisan::call('database:create');
$output .= \Artisan::output();
Artisan::call('database:create');
$output .= Artisan::output();
}
return trim($output);