From 715726d330cfbb2b8eaefb9c2978ac0d0d82efad Mon Sep 17 00:00:00 2001 From: Julian Prieber Date: Mon, 13 Feb 2023 13:22:49 +0100 Subject: [PATCH] Fixed 404 error when installing https://github.com/JulianPrieber/littlelink-custom/issues/313 https://www.youtube.com/watch?v=VJpZMZOBeB0 --- app/Http/Controllers/InstallerController.php | 11 +++++++++++ routes/web.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/InstallerController.php b/app/Http/Controllers/InstallerController.php index 7ea4661..35e26a1 100644 --- a/app/Http/Controllers/InstallerController.php +++ b/app/Http/Controllers/InstallerController.php @@ -53,6 +53,11 @@ class InstallerController extends Controller $handle = $request->handle; $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'){ Schema::disableForeignKeyConstraints(); @@ -137,6 +142,12 @@ class InstallerController extends Controller 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('')); } diff --git a/routes/web.php b/routes/web.php index 722f163..e176bfa 100755 --- a/routes/web.php +++ b/routes/web.php @@ -42,7 +42,7 @@ if(file_exists(base_path('INSTALLING'))){ Route::get('{any}', function() { 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 { return redirect(url('')); }