Added independent backup system

This commit is contained in:
Julian Prieber 2022-08-06 12:20:28 +02:00
parent 33fd0f7e10
commit b51b7c46a8
4 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,63 @@
<title>Backup</title>
@extends('layouts.updater')
@Push('updater-body')
<div class="container">
@if($_SERVER['QUERY_STRING'] === '')
<?php //landing page ?>
<div class="logo-container fadein">
<img class="logo-img" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo">
<div class="logo-centered">l</div>
</div>
<h1>Backup</h1>
<h4 class="">You can back up your entire instance:</h4>
<h5 class="">The backup system won't save more than two backups at a time.</h5>
<br><div class="row">
&ensp;<a class="btn" href="{{url()->current()}}/?backup"><button><i class="fa-solid fa-floppy-disk"></i> Backup Instance</button></a>&ensp;
&ensp;<a class="btn" href="{{ route('showBackups') }}"><button><i class="fa-solid fa-box-archive"></i> All Backups</button></a>&ensp;
</div>
@endif
@if($_SERVER['QUERY_STRING'] === 'backup')
<?php //creating backup... ?>
@Push('updater-head')
<meta http-equiv="refresh" content="2; URL={{url()->current()}}/?backups" />
@endpush
<div class="logo-container fadein">
<img class="logo-img loading" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo">
<div class="logo-centered">l</div>
</div>
<h1 class="loadingtxt">Creating backup</h1>
@endif
@if($_SERVER['QUERY_STRING'] === 'backups')
<?php Artisan::call('backup:clean');
Artisan::call('backup:run', ['--only-files' => true]);
$tst = base_path('backups/');
file_put_contents($tst.'CANUPDATE', '');
$URL = Route::current()->getName();
header("Location: ".$URL."?success");
exit(); ?>
@endif
@if($_SERVER['QUERY_STRING'] === 'success')
<?php //after successfully updating ?>
<div class="logo-container fadein">
<img class="logo-img" src="{{ asset('littlelink/images/just-gear.svg') }}" alt="Logo">
<div class="logo-centered">l</div>
</div>
<h1>Success!</h1>
<h4 class="">The backup was successful, you can now return to the Admin Panel or see all your backups.</h4>
<br><div class="row">
&ensp;<a class="btn" href="{{ route('studioIndex') }}"><button><i class="fa-solid fa-house-laptop btn"></i> Admin Panel</button></a>&ensp;
&ensp;<a class="btn" href="{{ route('showBackups') }}"><button><i class="fa-solid fa-box-archive"></i> All Backups</button></a>&ensp;
</div>
@endif
</div>
@endpush

View File

@ -1,7 +1,7 @@
@extends('layouts.sidebar')
@section('content')
<style>.buttondm{display:inline-block;text-decoration:none;height:48px;text-align:center;vertical-align:middle;font-size:18px;width:300px;font-weight:700;line-height:48px;letter-spacing:.1px;white-space:wrap;border-radius:8px;cursor:pointer}.button-hover,.credit-hover{display:inline-block;-webkit-transform:perspective(1px) translateZ(0);transform:perspective(1px) translateZ(0);box-shadow:0 0 1px rgba(0,0,0,0);-webkit-transition-duration:.3s;transition-duration:.3s;-webkit-transition-property:transform;transition-property:transform}.button-hover:active,.credit-hover:active,.button-hover:focus,.credit-hover:focus,.button-hover:hover,.credit-hover:hover{-webkit-transform:scale(1.06);transform:scale(1.06)}.container{align-items:center;display:flex;flex-direction:column;justify-content:center;height:50%;width:100%}</style>
<style>button{border-style: none;background-color: #0085ff;color: #fff;padding: 13px;border-radius: 5px;}button:hover {background-color:#0065c1;color: #FFF;box-shadow: 0 10px 20px -10px rgba(0,0,0, 0.6);}.btn {color: #FFF !important;}.buttondm{display:inline-block;text-decoration:none;height:48px;text-align:center;vertical-align:middle;font-size:18px;width:300px;font-weight:700;line-height:48px;letter-spacing:.1px;white-space:wrap;border-radius:8px;cursor:pointer}.button-hover,.credit-hover{display:inline-block;-webkit-transform:perspective(1px) translateZ(0);transform:perspective(1px) translateZ(0);box-shadow:0 0 1px rgba(0,0,0,0);-webkit-transition-duration:.3s;transition-duration:.3s;-webkit-transition-property:transform;transition-property:transform}.button-hover:active,.credit-hover:active,.button-hover:focus,.credit-hover:focus,.button-hover:hover,.credit-hover:hover{-webkit-transform:scale(1.06);transform:scale(1.06)}.container{align-items:center;display:flex;flex-direction:column;justify-content:center;height:50%;width:100%}</style>
<!-- Custom icons font-awesome -->
<script src="https://kit.fontawesome.com/c4a5e06183.js" crossorigin="anonymous"></script>
@if (file_exists(base_path('backups/updater-backups/')) and is_dir(base_path('backups/updater-backups/')))
@ -42,4 +42,5 @@
<div class="container">
<h3>No backups found</h3></div>
@endif
<center><a class="btn" href="{{ url('backup') }}"><button><i class="fa-solid fa-floppy-disk"></i> Backup your instance</button></a></center>
@endsection

View File

@ -3,6 +3,7 @@
<div>
<div class="h5 my-4">{{__($translatePrefix.'title')}}</div>
<div class="h5 my-4">You can find your updater backups <span><a href="{{ url('panel/backups') }}">here</a></span></div>
<div class="h5 my-4">You can backup your instance <span><a href="{{ url('backup') }}">here</a></span></div>
<div>
<button class="btn-info btn " @click="createBackUp">{{__($translatePrefix.'btn.backUpCurrentEnv')}}</button>
<a class="btn-info btn" href="{{route(config($package.'.route.name').'.download')}}">{{__($translatePrefix.'btn.downloadCurrentEnv')}}</a>

View File

@ -121,6 +121,7 @@ Route::get('/panel/backups', [AdminController::class, 'showBackups'])->name('sho
Route::post('/panel/theme', [AdminController::class, 'deleteTheme'])->name('deleteTheme');
Route::get('/panel/theme', [AdminController::class, 'showThemes'])->name('showThemes');
Route::get('/update', function () {return view('update', []);});
Route::get('/backup', function () {return view('backup', []);});
Route::get('/updating', function (\Codedge\Updater\UpdaterManager $updater) {