Remove Dig and Whois binary requirements, revert fetchUpdates function

This commit is contained in:
johnnyq
2026-07-05 16:05:19 -04:00
parent d1e1609b8a
commit 78c3dd0eed
3 changed files with 17 additions and 31 deletions

View File

@@ -147,7 +147,7 @@ $phpConfig[] = [
$shellCommands = []; $shellCommands = [];
if ($shell_exec_enabled) { if ($shell_exec_enabled) {
$commands = ['whois', 'dig', 'git']; $commands = ['git'];
foreach ($commands as $command) { foreach ($commands as $command) {
$which = trim(shell_exec("which $command 2>/dev/null")); $which = trim(shell_exec("which $command 2>/dev/null"));
@@ -160,7 +160,7 @@ if ($shell_exec_enabled) {
} }
} else { } else {
// If shell_exec is disabled, mark commands as unavailable // If shell_exec is disabled, mark commands as unavailable
foreach (['whois', 'dig', 'git'] as $command) { foreach (['git'] as $command) {
$shellCommands[] = [ $shellCommands[] = [
'name' => "Command '$command' available", 'name' => "Command '$command' available",
'passed' => false, 'passed' => false,

View File

@@ -1053,38 +1053,22 @@ function getTicketStatusName($ticket_status) {
} }
function fetchUpdates() { function fetchUpdates() {
global $repo_branch; global $repo_branch;
$repo_dir = dirname(__DIR__); // Adjust to wherever the repo root is relative to this file // 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");
$output = array(); if ($current_version == $latest_version) {
$result = 0; $update_message = "No Updates available";
$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';
} else { } else {
$update_message = "New Updates are Available [$latest_version]"; $update_message = "New Updates are Available [$latest_version]";
} }
$updates = new stdClass(); $updates = new stdClass();
$updates->output = $output; $updates->output = $output;
$updates->result = $result; $updates->result = $result;
@@ -1092,7 +1076,9 @@ function fetchUpdates() {
$updates->latest_version = $latest_version; $updates->latest_version = $latest_version;
$updates->update_message = $update_message; $updates->update_message = $update_message;
return $updates; return $updates;
} }

View File

@@ -939,7 +939,7 @@ if (isset($_POST['add_telemetry'])) {
$shellCommands = []; $shellCommands = [];
if ($shell_exec_enabled) { if ($shell_exec_enabled) {
$commands = ['whois', 'dig', 'git']; $commands = ['git'];
foreach ($commands as $command) { foreach ($commands as $command) {
$which = trim(shell_exec("which $command 2>/dev/null")); $which = trim(shell_exec("which $command 2>/dev/null"));