From 3ffb6ee814642b32e497be04cec00e655192bafc Mon Sep 17 00:00:00 2001 From: Jerome Marchand Date: Mon, 11 Mar 2019 11:27:48 +0100 Subject: [PATCH] Use buildin function to get version --- check_pf_version | 79 ++++++------------------------------------------ 1 file changed, 10 insertions(+), 69 deletions(-) diff --git a/check_pf_version b/check_pf_version index e411fe2..7241056 100644 --- a/check_pf_version +++ b/check_pf_version @@ -1,78 +1,19 @@ #!/usr/local/bin/php -f 60*60*6) || (count(file($tmp_filename))>2) ) { - //echo "need new remote file\n"; - -if(download_file_with_progress_bar("{$updater_url}/version{$nanosize}", "/home/nagios/{$g['product_name']}_version", 'read_body', 5, 5) === true) - { sleep (5); $remote_version = trim(@file_get_contents("/home/nagios/{$g['product_name']}_version")); } - -if ( (count(file($tmp_filename))>2) ) { - $static_text = gettext("UNKNOWN - unable to check for updates.") . "\n"; - $exitcode = 3; - $remote_version = "Error"; - if(isset($curcfg['alturl']['enable'])) - $static_text .= gettext("Could not contact custom update server.") . "\n"; - else - $static_text .= sprintf(gettext('Could not contact %1$s update server %2$s%3$s'), $g['product_name'], $updater_url, "\n"); -} - -} - -if ($static_text !== "") -{ $additional_info = $static_text; } -/* -elseif ( pfs_version_compare($current_installed_buildtime, $current_installed_version, $remote_version) == -1) -{ $additional_info = "WARNING - new version available\n" ; $exitcode = 1; } -else -{ $additional_info = "OK - already at latest version\n" ; $exitcode = 0; } -*/ -$additional_info .= "Current version: ".$current_installed_version." / ".$current_installed_buildtime; -#$additional_info .= "Current version: ".$current_installed_version."\n"; -#$additional_info .= "Built on: ".$current_installed_buildtime; -#$additional_info .= "Remote version: ".$remote_version."\n"; +$additional_info .= "Current version: ".$system_pkg_version['installed_version']."\n"; +$additional_info .= "Built on: ".$current_installed_buildtime."\n"; +$additional_info .= "Remote version: ".$system_pkg_version['version']."\n"; echo $additional_info; - -#exit ($exitcode); - -?> - +exit ($exitcode); \ No newline at end of file