Skip to content

Commit 99ae84d

Browse files
committed
Updated Maintenance Mode
1 parent f0c96b9 commit 99ae84d

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

resources/views/maintenance.blade.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@if($_SERVER['QUERY_STRING'] === '')
12
<!DOCTYPE html>
23
@include('layouts.lang')
34
<head>
@@ -92,10 +93,22 @@
9293
<h1 style="font-size: 300%;"><i class="fa-solid fa-screwdriver-wrench"></i> Maintenance Mode <i class="fa-solid fa-screwdriver-wrench"></i></h1>
9394
<h2>We are performing scheduled site maintenance at this time.</h2>
9495
<h3>Please check back with us later.</h3>
96+
@if(auth()->user()->role == 'admin')
97+
<br><center><i>Admin options:</i></center>
98+
<a href="{{url('dashboard')}}">Dashboard</a> | <a href="{{url('?maintenance=off')}}" onclick="return confirm('You are about to disable Maintenance Mode. Are you sure?');">Turn off</a>
99+
@endif
95100
</div>
96101

97102
</div>
98103
</div>
99104
</div>
100105
</body>
101106
</html>
107+
@elseif($_SERVER['QUERY_STRING'] === 'maintenance=off')
108+
@php
109+
EnvEditor::editKey('MAINTENANCE_MODE', false);
110+
ob_clean();
111+
header("Location: " . url('dashboard'));
112+
exit;
113+
@endphp
114+
@endif

resources/views/update.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192

193193
@include('components.finishing')
194194

195-
<?php if(file_exists(base_path("storage/MAINTENANCE"))){unlink(base_path("storage/MAINTENANCE"));} ?>
195+
<?php EnvEditor::editKey('MAINTENANCE_MODE', false); ?>
196196
<?php
197197
if($debug === true){
198198
if(EnvEditor::keyExists('APP_DEBUG')){EnvEditor::editKey('APP_DEBUG', 'false');}
@@ -234,7 +234,7 @@
234234
@if($_SERVER['QUERY_STRING'] === 'error')
235235
<?php //on error ?>
236236

237-
<?php if(file_exists(base_path("storage/MAINTENANCE"))){unlink(base_path("storage/MAINTENANCE"));} ?>
237+
<?php EnvEditor::editKey('MAINTENANCE_MODE', false); ?>
238238

239239
<div class="logo-container fadein">
240240
<img class="logo-img" src="{{ asset('assets/linkstack/images/logo.svg') }}" alt="Logo">

routes/web.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
}else{
5252

5353
// Disables routes if in Maintenance Mode
54-
if(env('MAINTENANCE_MODE') != 'true' and !file_exists(base_path("storage/MAINTENANCE"))){
54+
if(env('MAINTENANCE_MODE') != 'true'){
5555

5656
//Changes the homepage to a LinkStack profile if set in the config
5757
if(config('advanced-config.custom_home_url') != '') {
@@ -195,8 +195,7 @@
195195
// Check if new version is available
196196
if($updater->source()->isNewVersionAvailable() and (file_exists(base_path("backups/CANUPDATE")) or env('SKIP_UPDATE_BACKUP') == true)) {
197197

198-
$tst = base_path('storage/');
199-
file_put_contents($tst.'MAINTENANCE', '');
198+
EnvEditor::editKey('MAINTENANCE_MODE', true);
200199

201200
// Get the current installed version
202201
echo $updater->source()->getVersionInstalled();

0 commit comments

Comments
 (0)