Julian Prieber 2023-02-13 13:22:49 +01:00
parent 1726d027b2
commit 715726d330
2 changed files with 12 additions and 1 deletions

View File

@ -53,6 +53,11 @@ class InstallerController extends Controller
$handle = $request->handle; $handle = $request->handle;
$name = $request->name; $name = $request->name;
$file = base_path('INSTALLERLOCK');
if (!file_exists($file)) {
$handle = fopen($file, 'w') or die('Cannot create file: '.$file);
fclose($handle);
}
if(DB::table('users')->count() == '0'){ if(DB::table('users')->count() == '0'){
Schema::disableForeignKeyConstraints(); Schema::disableForeignKeyConstraints();
@ -137,6 +142,12 @@ class InstallerController extends Controller
if(file_exists(base_path("INSTALLING"))){unlink(base_path("INSTALLING"));} if(file_exists(base_path("INSTALLING"))){unlink(base_path("INSTALLING"));}
$file = base_path('INSTALLERLOCK');
if (file_exists($file)) {
unlink($file) or die('Cannot delete file: '.$file);
sleep(1);
}
return redirect(url('')); return redirect(url(''));
} }

View File

@ -42,7 +42,7 @@ if(file_exists(base_path('INSTALLING'))){
Route::get('{any}', function() { Route::get('{any}', function() {
if(!DB::table('users')->get()->isEmpty()){ if(!DB::table('users')->get()->isEmpty()){
if(file_exists(base_path("INSTALLING"))){unlink(base_path("INSTALLING"));header("Refresh:0");} if(file_exists(base_path("INSTALLING")) and !file_exists(base_path('INSTALLERLOCK'))){unlink(base_path("INSTALLING"));header("Refresh:0");}
} else { } else {
return redirect(url('')); return redirect(url(''));
} }