From 5aa7128b9c37d8769ed5dc3e507f184b3e5597d9 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Wed, 8 May 2024 11:52:28 +0200 Subject: [PATCH] backwards compatibility --- app/Services/Servers/BuildModificationService.php | 4 ++++ app/Services/Servers/ServerCreationService.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/app/Services/Servers/BuildModificationService.php b/app/Services/Servers/BuildModificationService.php index 2f2a0bda5..8743f61eb 100644 --- a/app/Services/Servers/BuildModificationService.php +++ b/app/Services/Servers/BuildModificationService.php @@ -40,6 +40,10 @@ class BuildModificationService throw_unless($existingAllocation, new DisplayException('The requested default allocation is not currently assigned to this server.')); } + if(!isset($data['oom_killer']) && isset($data['oom_disabled'])) { + $data['oom_killer'] = !$data['oom_disabled']; + } + // If any of these values are passed through in the data array go ahead and set them correctly on the server model. $merge = Arr::only($data, ['oom_killer', 'memory', 'swap', 'io', 'cpu', 'threads', 'disk', 'allocation_id']); diff --git a/app/Services/Servers/ServerCreationService.php b/app/Services/Servers/ServerCreationService.php index 7831d1a40..37dcd5c06 100644 --- a/app/Services/Servers/ServerCreationService.php +++ b/app/Services/Servers/ServerCreationService.php @@ -47,6 +47,10 @@ class ServerCreationService */ public function handle(array $data, DeploymentObject $deployment = null): Server { + if(!isset($data['oom_killer']) && isset($data['oom_disabled'])) { + $data['oom_killer'] = !$data['oom_disabled']; + } + // If a deployment object has been passed we need to get the allocation // that the server should use, and assign the node from that allocation. if ($deployment instanceof DeploymentObject) {