From e190004682139425ca01aeaf3b5cdff62e25ad27 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Wed, 30 Apr 2025 21:14:37 +0200 Subject: [PATCH] refactor(logdrain): consolidate log drain stopping logic to reduce redundancy --- app/Actions/Server/StartLogDrain.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/Actions/Server/StartLogDrain.php b/app/Actions/Server/StartLogDrain.php index 0d28a0099..f72f23696 100644 --- a/app/Actions/Server/StartLogDrain.php +++ b/app/Actions/Server/StartLogDrain.php @@ -15,19 +15,18 @@ class StartLogDrain { if ($server->settings->is_logdrain_newrelic_enabled) { $type = 'newrelic'; - StopLogDrain::run($server); } elseif ($server->settings->is_logdrain_highlight_enabled) { $type = 'highlight'; - StopLogDrain::run($server); } elseif ($server->settings->is_logdrain_axiom_enabled) { $type = 'axiom'; - StopLogDrain::run($server); } elseif ($server->settings->is_logdrain_custom_enabled) { $type = 'custom'; - StopLogDrain::run($server); } else { $type = 'none'; } + if ($type !== 'none') { + StopLogDrain::run($server); + } try { if ($type === 'none') { return 'No log drain is enabled.'; @@ -186,7 +185,6 @@ Files: "echo '{$compose}' | base64 -d | tee $compose_path > /dev/null", "echo '{$readme}' | base64 -d | tee $readme_path > /dev/null", "test -f $config_path/.env && rm $config_path/.env", - ]; if ($type === 'newrelic') { $add_envs_command = [