diff options
author | Ermal <eri@pfsense.org> | 2010-03-19 15:34:56 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-03-19 15:34:56 +0000 |
commit | 773c99bc37c742cc94a1894914c5ba4a7b5abdd7 (patch) | |
tree | 162bb355b699de6caef49167c93eb26d6ae7bb80 /usr/local/www/widgets | |
parent | f3b000b2d10cf2010563b28b8107706178e64081 (diff) | |
download | pfsense-773c99bc37c742cc94a1894914c5ba4a7b5abdd7.zip pfsense-773c99bc37c742cc94a1894914c5ba4a7b5abdd7.tar.gz |
Fix auto update checking and showing always there is an update available.
Diffstat (limited to 'usr/local/www/widgets')
-rw-r--r-- | usr/local/www/widgets/widgets/system_information.widget.php | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/usr/local/www/widgets/widgets/system_information.widget.php b/usr/local/www/widgets/widgets/system_information.widget.php index d275010..294867d 100644 --- a/usr/local/www/widgets/widgets/system_information.widget.php +++ b/usr/local/www/widgets/widgets/system_information.widget.php @@ -40,35 +40,28 @@ if($_REQUEST['getupdatestatus']) { $updater_url = "{$config['system']['firmware']['alturl']['firmwareurl']}"; else $updater_url = $g['update_url']; - /* ensure we can obtain the DNS information quickly */ - $host = split("/", $updater_url); - $test_dns = `/usr/bin/host -W1 {$host[2]} | grep "has address" | awk '{ print $4 }' | wc -l`; - if($test_dns) - $latest_version = download_file_with_progress_bar("{$updater_url}/version", "/tmp/{$g['product_name']}_version"); - else - $latest_version ="404"; - if(strstr($latest_version,"404")) { + download_file_with_progress_bar("{$updater_url}/version", "/tmp/{$g['product_name']}_version"); + $latest_version = file_get_contents("/tmp/{$g['product_name']}_version"); + if(empty($latest_version)) echo "<br /><br />Unable to check for updates."; - } else { - $current_installed_pfsense_version = str_replace("\n", "", file_get_contents("/etc/version")); - $latest_version = str_replace("\n", "", file_get_contents("/tmp/{$g['product_name']}_version")); - $needs_system_upgrade = false; - if($current_installed_pfsense_version <> $latest_version) - $needs_system_upgrade = true; + else { + $current_installed_pfsense_version = strtotime(str_replace("\n", "", file_get_contents("/etc/version.buildtime"))); + + $latest_version = strtotime(str_replace("\n", "", file_get_contents("/tmp/{$g['product_name']}_version"))); if(!$latest_version) { echo "<br /><br />Unable to check for updates."; } else { - if($needs_system_upgrade) { + $needs_system_upgrade = false; + if($current_installed_pfsense_version < $latest_version) { echo "<br/><span class=\"red\" id=\"updatealert\"><b>Update available. </b></span><a href=\"/system_firmware_check.php\">Click Here</a> to view update."; echo "<script type=\"text/javascript\">"; echo "Effect.Pulsate('updatealert', { pulses: 30, duration: 10});"; echo "</script>"; - } else { + } else echo "<br /><br />You are on the latest version."; - } - } - } + } + } exit; } |