Skip to content

Commit 3b08b5b

Browse files
committed
Disabling maintenance mode now forces application out of maintenance
1 parent 7addf29 commit 3b08b5b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

app/Http/Controllers/AdminController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,10 @@ public function editConfig(request $request)
513513
} elseif($type === "homeurl") {
514514
if($request->value == 'default'){$value = "";}else{$value = '"' . $request->value . '"';}
515515
if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);}
516+
} elseif($type === "maintenance") {
517+
if($request->toggle != ''){$value = "true";}else{$value = "false";}
518+
if(file_exists(base_path("storage/MAINTENANCE"))){unlink(base_path("storage/MAINTENANCE"));}
519+
if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);}
516520
} else {
517521
if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);}
518522
}

resources/views/components/config/config.blade.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,24 @@ function text($key){
311311
<h2 class="ch2">Advanced</h2>
312312

313313

314-
{{toggle('MAINTENANCE_MODE')}}
314+
{{-- start MAINTENANCE_MODE --}}
315+
<form id="MAINTENANCE_MODE-form" action="{{route('editConfig')}}" enctype="multipart/form-data" method="post">
316+
<div class="form-group col-lg-8">
317+
<input value="maintenance" name="type" style="display:none;" type="text" required>
318+
<input value="MAINTENANCE_MODE" name="entry" style="display:none;" type="text" required>
319+
<h5 style="margin-top:50px">Enable Maintenance Mode</h5>
320+
<p class="text-muted">Displays a maintenance message on all public pages. This will disable the login pages.</p>
321+
<div class="input-group">
322+
<div class="row toggle-btn"><input name="toggle" class="switch toggle-btn" type="checkbox" id="MAINTENANCE_MODE" <?php if(EnvEditor::getKey('MAINTENANCE_MODE') == 'true' or file_exists(base_path("storage/MAINTENANCE"))){echo 'checked>';}else{echo '/>';} ?><label for="MAINTENANCE_MODE" class="label txt-label">Enable</label></div>
323+
</div></div>
324+
<input type="hidden" name="_token" value="{{csrf_token()}}">
325+
<script type="text/javascript">
326+
document.getElementById("MAINTENANCE_MODE-form").addEventListener("change", function() {
327+
this.submit();
328+
});
329+
</script>
330+
</form>
331+
{{-- end MAINTENANCE_MODE --}}
315332

316333

317334
{{toggle('JOIN_BETA')}}

0 commit comments

Comments
 (0)