Disabling maintenance mode now forces application out of maintenance

This commit is contained in:
Julian Prieber 2022-11-20 15:13:53 +01:00
parent 7addf2912a
commit 3b08b5b6d9
2 changed files with 22 additions and 1 deletions

View File

@ -513,6 +513,10 @@ class AdminController extends Controller
} elseif($type === "homeurl") {
if($request->value == 'default'){$value = "";}else{$value = '"' . $request->value . '"';}
if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);}
} elseif($type === "maintenance") {
if($request->toggle != ''){$value = "true";}else{$value = "false";}
if(file_exists(base_path("storage/MAINTENANCE"))){unlink(base_path("storage/MAINTENANCE"));}
if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);}
} else {
if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);}
}

View File

@ -311,7 +311,24 @@ foreach($users as $user){if($user->littlelink_name != $configValue2){echo '<opti
<h2 class="ch2">Advanced</h2>
{{toggle('MAINTENANCE_MODE')}}
{{-- start MAINTENANCE_MODE --}}
<form id="MAINTENANCE_MODE-form" action="{{route('editConfig')}}" enctype="multipart/form-data" method="post">
<div class="form-group col-lg-8">
<input value="maintenance" name="type" style="display:none;" type="text" required>
<input value="MAINTENANCE_MODE" name="entry" style="display:none;" type="text" required>
<h5 style="margin-top:50px">Enable Maintenance Mode</h5>
<p class="text-muted">Displays a maintenance message on all public pages. This will disable the login pages.</p>
<div class="input-group">
<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>
</div></div>
<input type="hidden" name="_token" value="{{csrf_token()}}">
<script type="text/javascript">
document.getElementById("MAINTENANCE_MODE-form").addEventListener("change", function() {
this.submit();
});
</script>
</form>
{{-- end MAINTENANCE_MODE --}}
{{toggle('JOIN_BETA')}}