From 78c3dd0eedec25186f82951fca33b5a372a8a560 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sun, 5 Jul 2026 16:05:19 -0400 Subject: [PATCH] Remove Dig and Whois binary requirements, revert fetchUpdates function --- admin/debug.php | 4 ++-- functions.php | 42 ++++++++++++++---------------------------- setup/index.php | 2 +- 3 files changed, 17 insertions(+), 31 deletions(-) diff --git a/admin/debug.php b/admin/debug.php index c59c1532..a0759651 100644 --- a/admin/debug.php +++ b/admin/debug.php @@ -147,7 +147,7 @@ $phpConfig[] = [ $shellCommands = []; if ($shell_exec_enabled) { - $commands = ['whois', 'dig', 'git']; + $commands = ['git']; foreach ($commands as $command) { $which = trim(shell_exec("which $command 2>/dev/null")); @@ -160,7 +160,7 @@ if ($shell_exec_enabled) { } } else { // If shell_exec is disabled, mark commands as unavailable - foreach (['whois', 'dig', 'git'] as $command) { + foreach (['git'] as $command) { $shellCommands[] = [ 'name' => "Command '$command' available", 'passed' => false, diff --git a/functions.php b/functions.php index 86b7781b..eebf38de 100644 --- a/functions.php +++ b/functions.php @@ -1053,46 +1053,32 @@ function getTicketStatusName($ticket_status) { } - function fetchUpdates() { + global $repo_branch; - - $repo_dir = dirname(__DIR__); // Adjust to wherever the repo root is relative to this file - - $output = array(); - $result = 0; - - $current_version = getCurrentGitCommit($repo_dir); - if (empty($current_version)) { - $output[] = 'Could not read current commit from .git - check file permissions'; - $result = 1; - } - - $repo = getGitHubRepoFromConfig($repo_dir); - - $api_error = null; - $latest_version = getLatestGitCommit($repo, $repo_branch, $api_error); - if (empty($latest_version)) { - $output[] = $api_error ?: 'Could not determine latest commit'; - $result = 1; - } - - if ($result !== 0) { - $update_message = 'Update check failed'; - } elseif ($current_version == $latest_version) { - $update_message = 'No Updates available'; + + // Fetch the latest code changes but don't apply them + exec("git fetch", $output, $result); + $latest_version = exec("git rev-parse origin/$repo_branch"); + $current_version = exec("git rev-parse HEAD"); + + if ($current_version == $latest_version) { + $update_message = "No Updates available"; } else { $update_message = "New Updates are Available [$latest_version]"; } - + + $updates = new stdClass(); $updates->output = $output; $updates->result = $result; $updates->current_version = $current_version; $updates->latest_version = $latest_version; $updates->update_message = $update_message; - + + return $updates; + } diff --git a/setup/index.php b/setup/index.php index 334420cf..8cebdf1b 100644 --- a/setup/index.php +++ b/setup/index.php @@ -939,7 +939,7 @@ if (isset($_POST['add_telemetry'])) { $shellCommands = []; if ($shell_exec_enabled) { - $commands = ['whois', 'dig', 'git']; + $commands = ['git']; foreach ($commands as $command) { $which = trim(shell_exec("which $command 2>/dev/null"));