Error handling around reset install; clear cache
This commit is contained in:
@@ -9,6 +9,8 @@ use App\Models\Pirep;
|
||||
use App\Models\User;
|
||||
use App\Services\AwardService;
|
||||
use App\Services\DatabaseService;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use PDO;
|
||||
@@ -225,21 +227,35 @@ class DevCommands extends Command
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (config('database.default') === 'mysql') {
|
||||
DB::statement('SET foreign_key_checks=0');
|
||||
}
|
||||
try {
|
||||
if (config('database.default') === 'mysql') {
|
||||
DB::statement('SET foreign_key_checks=0');
|
||||
}
|
||||
|
||||
$this->info('Dropping all tables');
|
||||
$tables = DB::connection()->getDoctrineSchemaManager()->listTableNames();
|
||||
foreach ($tables as $table) {
|
||||
Schema::dropIfExists($table);
|
||||
$this->info('Dropping all tables');
|
||||
$tables = DB::connection()->getDoctrineSchemaManager()->listTableNames();
|
||||
foreach ($tables as $table) {
|
||||
Schema::dropIfExists($table);
|
||||
}
|
||||
} catch (QueryException $e) {
|
||||
$this->error('DB error: '.$e->getMessage());
|
||||
}
|
||||
|
||||
$this->info('Deleting config file');
|
||||
unlink('config.php');
|
||||
try {
|
||||
unlink('config.php');
|
||||
} catch (\Exception $e) { }
|
||||
|
||||
$this->info('Deleting env file');
|
||||
unlink('env.php');
|
||||
try {
|
||||
unlink('env.php');
|
||||
} catch (\Exception $e) { }
|
||||
|
||||
$this->info('Clearing caches');
|
||||
Artisan::call('cache:clear');
|
||||
Artisan::call('route:clear');
|
||||
Artisan::call('config:clear');
|
||||
Artisan::call('view:clear');
|
||||
|
||||
$this->info('Done!');
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ return [
|
||||
'cache' => [
|
||||
'enabled' => true,
|
||||
'key' => 'phpvms-modules',
|
||||
'lifetime' => 60,
|
||||
'lifetime' => 10,
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -279,7 +279,7 @@ class InstallerController extends Controller
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'airline_name' => 'required',
|
||||
'airline_icao' => 'required|unique:airlines,icao',
|
||||
'airline_icao' => 'required|size:3|unique:airlines,icao',
|
||||
'airline_country' => 'required',
|
||||
'name' => 'required',
|
||||
'email' => 'required|email|unique:users,email',
|
||||
|
||||
Reference in New Issue
Block a user