From 54035ce5c4bb2b15f23459e855fa7630ea2fd954 Mon Sep 17 00:00:00 2001 From: Julian Prieber <60265788+JulianPrieber@users.noreply.github.com> Date: Mon, 30 May 2022 11:39:39 +0200 Subject: [PATCH] Added skip backup on update option Added skip backup on update option to config --- config/self-update.php | 11 +-------- resources/views/update.blade.php | 39 +++++++++++++++++++------------- routes/web.php | 4 ++-- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/config/self-update.php b/config/self-update.php index 0a1c7ba..636a59a 100644 --- a/config/self-update.php +++ b/config/self-update.php @@ -2,18 +2,9 @@ declare(strict_types=1); -$Vlocal = 'v' . file_get_contents(base_path("version.json")); if (env('JOIN_BETA') == true) { - $Vgit = file_get_contents("https://julianprieber.github.io/littlelink-custom/version.json"); -} else { - $Vgit = '0'; -} - -if ($Vgit > $Vlocal) { - $userver = 'https://update.littlelink-custom.com/'; -} elseif (env('JOIN_BETA') == true) { - $userver = 'https://update.littlelink-custom.com/beta/'; + $userver = 'https://beta.littlelink-custom.com/'; } else { $userver = 'https://update.littlelink-custom.com/'; } diff --git a/resources/views/update.blade.php b/resources/views/update.blade.php index be2299e..046d6e7 100644 --- a/resources/views/update.blade.php +++ b/resources/views/update.blade.php @@ -4,10 +4,10 @@
@if(auth()->user()->role == 'admin' and $Vgit > $Vlocal or env('JOIN_BETA') === true) @@ -15,13 +15,13 @@
- Logo + Logo
l

Updater

@if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')

The updater only works on Linux based systems.

- + @else @if(env('JOIN_BETA') === true)

@@ -31,8 +31,12 @@

You can update your installation automatically or download the update and install it manually:

@endif
-    -    + @if(env('SKIP_UPDATE_BACKUP') == true) +    + @else +    + @endif +  
@endif @@ -44,7 +48,7 @@ @endpush
- Logo + Logo
l

Creating backup

@@ -60,10 +64,10 @@ header("Location: ".$URL."?updating"); exit(); ?> @endif -@if($_SERVER['QUERY_STRING'] === 'updating' and (file_exists(base_path("backups/CANUPDATE")))) +@if($_SERVER['QUERY_STRING'] === 'updating' and (file_exists(base_path("backups/CANUPDATE")) or env('SKIP_UPDATE_BACKUP') == true))
- Logo + Logo
l

Updating

@@ -76,13 +80,13 @@ exit(); ?>
- Logo + Logo
l

No new version

There is no new version available


-    +  
@endif @@ -90,7 +94,7 @@ exit(); ?> @if($_SERVER['QUERY_STRING'] === 'finishing')
- Logo + Logo
l

Finishing up

@@ -101,6 +105,9 @@ exit(); ?> if(EnvEditor::keyExists('JOIN_BETA')){ /* Do nothing if key already exists */ } else { EnvEditor::addKey('JOIN_BETA', 'false');} // Adds key to .env file + if(EnvEditor::keyExists('SKIP_UPDATE_BACKUP')){ /* Do nothing if key already exists */ + } else { EnvEditor::addKey('SKIP_UPDATE_BACKUP', 'false');} // Adds key to .env file + echo "current() . "?success\" />"; ?> @endif @@ -109,13 +116,13 @@ exit(); ?>
- Logo + Logo
l

Success!

The update was successful, you can now return to the Admin Panel:


-    +  
@endif @@ -124,13 +131,13 @@ exit(); ?>
- Logo + Logo
l

Error

Something went wrong with the update :(


-    +  
@endif diff --git a/routes/web.php b/routes/web.php index bf4d661..ec5d73a 100755 --- a/routes/web.php +++ b/routes/web.php @@ -86,7 +86,7 @@ Route::get('/update', function () {return view('update', []);}); Route::get('/updating', function (\Codedge\Updater\UpdaterManager $updater) { // Check if new version is available - if($updater->source()->isNewVersionAvailable() and (file_exists(base_path("backups/CANUPDATE")))) { + if($updater->source()->isNewVersionAvailable() and (file_exists(base_path("backups/CANUPDATE")) or env('SKIP_UPDATE_BACKUP') == true)) { // Get the current installed version echo $updater->source()->getVersionInstalled(); @@ -100,7 +100,7 @@ Route::get('/updating', function (\Codedge\Updater\UpdaterManager $updater) { // Run the update process $updater->source()->update($release); - unlink(base_path("backups/CANUPDATE")); + if(env('SKIP_UPDATE_BACKUP') != true) {unlink(base_path("backups/CANUPDATE"));} echo "current() . "/../update?finishing\" />";