From 9651195318ffbfefebb4a07dfdaf53b1a19dd0ad Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 20 May 2025 11:07:55 +0200 Subject: [PATCH] Update app/Livewire/Server/Security/Patches.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- app/Livewire/Server/Security/Patches.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Livewire/Server/Security/Patches.php b/app/Livewire/Server/Security/Patches.php index 183055813..9392fc351 100644 --- a/app/Livewire/Server/Security/Patches.php +++ b/app/Livewire/Server/Security/Patches.php @@ -67,8 +67,18 @@ class Patches extends Component public function updateAllPackages() { + if (! $this->packageManager || ! $this->osId) { + $this->dispatch('error', message: 'Run “Check for updates” first.'); + return; + } + try { - $activity = UpdatePackage::run(server: $this->server, packageManager: $this->packageManager, osId: $this->osId, all: true); + $activity = UpdatePackage::run( + server: $this->server, + packageManager: $this->packageManager, + osId: $this->osId, + all: true + ); $this->dispatch('activityMonitor', $activity->id, ServerPackageUpdated::class); } catch (\Exception $e) { $this->dispatch('error', message: $e->getMessage());