Updated Maintenance Mode

This commit is contained in:
Julian Prieber 2023-05-26 00:58:13 +02:00
parent f0c96b954a
commit 99ae84db68
3 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,4 @@
@if($_SERVER['QUERY_STRING'] === '')
<!DOCTYPE html>
@include('layouts.lang')
<head>
@ -92,6 +93,10 @@ body {
<h1 style="font-size: 300%;"><i class="fa-solid fa-screwdriver-wrench"></i> Maintenance Mode <i class="fa-solid fa-screwdriver-wrench"></i></h1>
<h2>We are performing scheduled site maintenance at this time.</h2>
<h3>Please check back with us later.</h3>
@if(auth()->user()->role == 'admin')
<br><center><i>Admin options:</i></center>
<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>
@endif
</div>
</div>
@ -99,3 +104,11 @@ body {
</div>
</body>
</html>
@elseif($_SERVER['QUERY_STRING'] === 'maintenance=off')
@php
EnvEditor::editKey('MAINTENANCE_MODE', false);
ob_clean();
header("Location: " . url('dashboard'));
exit;
@endphp
@endif

View File

@ -192,7 +192,7 @@ if(EnvEditor::getKey('APP_DEBUG') == 'false'){
@include('components.finishing')
<?php if(file_exists(base_path("storage/MAINTENANCE"))){unlink(base_path("storage/MAINTENANCE"));} ?>
<?php EnvEditor::editKey('MAINTENANCE_MODE', false); ?>
<?php
if($debug === true){
if(EnvEditor::keyExists('APP_DEBUG')){EnvEditor::editKey('APP_DEBUG', 'false');}
@ -234,7 +234,7 @@ if($debug === true){
@if($_SERVER['QUERY_STRING'] === 'error')
<?php //on error ?>
<?php if(file_exists(base_path("storage/MAINTENANCE"))){unlink(base_path("storage/MAINTENANCE"));} ?>
<?php EnvEditor::editKey('MAINTENANCE_MODE', false); ?>
<div class="logo-container fadein">
<img class="logo-img" src="{{ asset('assets/linkstack/images/logo.svg') }}" alt="Logo">

View File

@ -51,7 +51,7 @@ if(file_exists(base_path('INSTALLING')) or file_exists(base_path('INSTALLERLOCK'
}else{
// Disables routes if in Maintenance Mode
if(env('MAINTENANCE_MODE') != 'true' and !file_exists(base_path("storage/MAINTENANCE"))){
if(env('MAINTENANCE_MODE') != 'true'){
//Changes the homepage to a LinkStack profile if set in the config
if(config('advanced-config.custom_home_url') != '') {
@ -195,8 +195,7 @@ Route::group([
// Check if new version is available
if($updater->source()->isNewVersionAvailable() and (file_exists(base_path("backups/CANUPDATE")) or env('SKIP_UPDATE_BACKUP') == true)) {
$tst = base_path('storage/');
file_put_contents($tst.'MAINTENANCE', '');
EnvEditor::editKey('MAINTENANCE_MODE', true);
// Get the current installed version
echo $updater->source()->getVersionInstalled();