Skip to content

Commit 715726d

Browse files
committed
Fixed 404 error when installing
#313 https://www.youtube.com/watch?v=VJpZMZOBeB0
1 parent 1726d02 commit 715726d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

app/Http/Controllers/InstallerController.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ public function createAdmin(request $request)
5353
$handle = $request->handle;
5454
$name = $request->name;
5555

56+
$file = base_path('INSTALLERLOCK');
57+
if (!file_exists($file)) {
58+
$handle = fopen($file, 'w') or die('Cannot create file: '.$file);
59+
fclose($handle);
60+
}
5661

5762
if(DB::table('users')->count() == '0'){
5863
Schema::disableForeignKeyConstraints();
@@ -137,6 +142,12 @@ public function options(request $request)
137142

138143
if(file_exists(base_path("INSTALLING"))){unlink(base_path("INSTALLING"));}
139144

145+
$file = base_path('INSTALLERLOCK');
146+
if (file_exists($file)) {
147+
unlink($file) or die('Cannot delete file: '.$file);
148+
sleep(1);
149+
}
150+
140151
return redirect(url(''));
141152
}
142153

routes/web.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
Route::get('{any}', function() {
4444
if(!DB::table('users')->get()->isEmpty()){
45-
if(file_exists(base_path("INSTALLING"))){unlink(base_path("INSTALLING"));header("Refresh:0");}
45+
if(file_exists(base_path("INSTALLING")) and !file_exists(base_path('INSTALLERLOCK'))){unlink(base_path("INSTALLING"));header("Refresh:0");}
4646
} else {
4747
return redirect(url(''));
4848
}

0 commit comments

Comments
 (0)