mirror of
https://github.com/itflow-org/itflow
synced 2026-07-23 00:40:45 +00:00
Remove Dig and Whois binary requirements, revert fetchUpdates function
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user