Skip to content

Commit 867f6c1

Browse files
committed
Update web.php
1 parent 694ea93 commit 867f6c1

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

routes/web.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,36 @@
8282
Route::post('/panel/site', [AdminController::class, 'editSite'])->name('editSite');
8383
Route::get('/panel/phpinfo', [AdminController::class, 'phpinfo'])->name('phpinfo');
8484
Route::get('/update', function () {return view('update', []);});
85+
86+
Route::get('/updating', function (\Codedge\Updater\UpdaterManager $updater) {
87+
88+
// Check if new version is available
89+
if($updater->source()->isNewVersionAvailable() and (file_exists(base_path("backups/CANUPDATE")))) {
90+
91+
// Get the current installed version
92+
echo $updater->source()->getVersionInstalled();
93+
94+
// Get the new version available
95+
$versionAvailable = $updater->source()->getVersionAvailable();
96+
97+
// Create a release
98+
$release = $updater->source()->fetch($versionAvailable);
99+
100+
// Run the update process
101+
$updater->source()->update($release);
102+
103+
unlink(base_path("backups/CANUPDATE"));
104+
105+
$URL = Route::current()->getName();
106+
header("Location: ".$URL."/../update?success");
107+
exit();
108+
109+
} else {
110+
echo "No new version available.";
111+
}
112+
113+
});
114+
85115
});
86116

87117
require __DIR__.'/auth.php';

0 commit comments

Comments
 (0)