diff options
author | Renato Botelho <renato@netgate.com> | 2015-07-31 10:03:34 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-07-31 10:03:34 -0300 |
commit | 5779ade6707ba530517da239d9ec3fc751d17d83 (patch) | |
tree | 9295a06ae80c1dd54611e7c279c42e3e242a6790 /usr | |
parent | 6fed300c6ae8c5bcac03f867daf737e2676dcc30 (diff) | |
download | pfsense-5779ade6707ba530517da239d9ec3fc751d17d83.zip pfsense-5779ade6707ba530517da239d9ec3fc751d17d83.tar.gz |
Introduce a new item to $g global, 'product_version' and stop reading /etc/version all around
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/pkg/miniupnpd.inc | 4 | ||||
-rw-r--r-- | usr/local/www/crash_reporter.php | 2 | ||||
-rw-r--r-- | usr/local/www/pkg_mgr_installed.php | 3 | ||||
-rw-r--r-- | usr/local/www/pkg_mgr_settings.php | 3 | ||||
-rwxr-xr-x | usr/local/www/system_firmware_auto.php | 7 | ||||
-rw-r--r-- | usr/local/www/system_firmware_check.php | 5 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/system_information.widget.php | 5 |
7 files changed, 12 insertions, 17 deletions
diff --git a/usr/local/pkg/miniupnpd.inc b/usr/local/pkg/miniupnpd.inc index a545744..4ea768c 100644 --- a/usr/local/pkg/miniupnpd.inc +++ b/usr/local/pkg/miniupnpd.inc @@ -145,7 +145,7 @@ } function sync_package_miniupnpd() { - global $config; + global $g, $config; global $input_errors; $upnp_config = $config['installedpackages']['miniupnpd']['config'][0]; @@ -238,7 +238,7 @@ $config_text .= "serial=".strtoupper(substr(upnp_uuid(), 0, 8))."\n"; /* set model number */ - $config_text .= "model_number=".file_get_contents("/etc/version")."\n"; + $config_text .= "model_number=" . $g['product_version'] . "\n"; /* upnp access restrictions */ foreach ($upnp_config['row'] as $row) { diff --git a/usr/local/www/crash_reporter.php b/usr/local/www/crash_reporter.php index 24cb36f..3b00e47 100644 --- a/usr/local/www/crash_reporter.php +++ b/usr/local/www/crash_reporter.php @@ -57,7 +57,7 @@ function upload_crash_report($files) { curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_VERBOSE, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version"))); + curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . $g['product_version']); curl_setopt($ch, CURLOPT_URL, $g['crashreporterurl']); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); diff --git a/usr/local/www/pkg_mgr_installed.php b/usr/local/www/pkg_mgr_installed.php index e190fec..3801271 100644 --- a/usr/local/www/pkg_mgr_installed.php +++ b/usr/local/www/pkg_mgr_installed.php @@ -109,10 +109,9 @@ include("head.inc"); <tr> <td> <?php - $version = file_get_contents("/etc/version"); $tab_array = array(); $tab_array[] = array(gettext("Available Packages"), false, "pkg_mgr.php"); -// $tab_array[] = array("{$version} " . gettext("packages"), false, "pkg_mgr.php"); +// $tab_array[] = array("{$g['product_version']} " . gettext("packages"), false, "pkg_mgr.php"); // $tab_array[] = array("Packages for any platform", false, "pkg_mgr.php?ver=none"); // $tab_array[] = array("Packages for a different platform", $requested_version == "other" ? true : false, "pkg_mgr.php?ver=other"); $tab_array[] = array(gettext("Installed Packages"), true, "pkg_mgr_installed.php"); diff --git a/usr/local/www/pkg_mgr_settings.php b/usr/local/www/pkg_mgr_settings.php index c222d28..04a5151 100644 --- a/usr/local/www/pkg_mgr_settings.php +++ b/usr/local/www/pkg_mgr_settings.php @@ -99,9 +99,8 @@ function enable_altpkgrepourl(enable_over) { <tr> <td> <?php - $version = file_get_contents("/etc/version"); $tab_array = array(); - $tab_array[] = array(sprintf(gettext("%s packages"), $version), false, "pkg_mgr.php"); + $tab_array[] = array(sprintf(gettext("%s packages"), $g['product_version']), false, "pkg_mgr.php"); $tab_array[] = array(gettext("Installed Packages"), false, "pkg_mgr_installed.php"); $tab_array[] = array(gettext("Package Settings"), true, "pkg_mgr_settings.php"); display_top_tabs($tab_array); diff --git a/usr/local/www/system_firmware_auto.php b/usr/local/www/system_firmware_auto.php index 9c15ae3..e2970fa 100755 --- a/usr/local/www/system_firmware_auto.php +++ b/usr/local/www/system_firmware_auto.php @@ -163,7 +163,6 @@ if (!$latest_version) { exit; } else { $current_installed_buildtime = trim(file_get_contents("/etc/version.buildtime")); - $current_installed_version = trim(file_get_contents("/etc/version")); $latest_version = trim(@file_get_contents("/tmp/{$g['product_name']}_version")); $latest_version_pfsense = strtotime($latest_version); if (!$latest_version) { @@ -171,7 +170,7 @@ if (!$latest_version) { require("fend.inc"); exit; } else { - if (pfs_version_compare($current_installed_buildtime, $current_installed_version, $latest_version) == -1) { + if (pfs_version_compare($current_installed_buildtime, $g['product_version'], $latest_version) == -1) { update_status(gettext("Downloading updates") . "..."); conf_mount_rw(); if ($g['platform'] == "nanobsd") { @@ -265,7 +264,7 @@ if ($downloaded_latest_tgz_sha256 <> $upgrade_latest_tgz_sha256) { */ function read_body_firmware($ch, $string) { - global $fout, $file_size, $downloaded, $counter, $version, $latest_version, $current_installed_version; + global $g, $fout, $file_size, $downloaded, $counter, $version, $latest_version; $length = strlen($string); $downloaded += intval($length); $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0); @@ -275,7 +274,7 @@ function read_body_firmware($ch, $string) { $c = $downloadProgress; $text = " " . gettext("Auto Update Download Status") . "\\n"; $text .= "----------------------------------------------------\\n"; - $text .= " " . gettext("Current Version") . " : {$current_installed_version}\\n"; + $text .= " " . gettext("Current Version") . " : {$g['product_version']}\\n"; $text .= " " . gettext("Latest Version") . " : {$latest_version}\\n"; $text .= " " . gettext("File size") . " : {$a}\\n"; $text .= " " . gettext("Downloaded") . " : {$b}\\n"; diff --git a/usr/local/www/system_firmware_check.php b/usr/local/www/system_firmware_check.php index d240a63..2e56943 100644 --- a/usr/local/www/system_firmware_check.php +++ b/usr/local/www/system_firmware_check.php @@ -157,12 +157,11 @@ if (!$remote_version) { update_output_window($static_text); $current_installed_buildtime = trim(file_get_contents("/etc/version.buildtime")); - $current_installed_version = trim(file_get_contents("/etc/version")); $static_text .= "done\\n"; update_output_window($static_text); - if (pfs_version_compare($current_installed_buildtime, $current_installed_version, $remote_version) == -1) { + if (pfs_version_compare($current_installed_buildtime, $g['product_version'], $remote_version) == -1) { $needs_system_upgrade = true; } else { $static_text .= "\\n" . gettext("You are on the latest version.") . "\\n"; @@ -191,7 +190,7 @@ echo "//]]>\n"; echo "</script>\n"; $txt = gettext("A new version is now available") . "\\n\\n"; -$txt .= gettext("Current version") . ": " . $current_installed_version . "\\n"; +$txt .= gettext("Current version") . ": " . $g['product_version'] . "\\n"; if ($g['platform'] == "nanobsd") { $txt .= " " . gettext("NanoBSD Size") . " : " . trim(file_get_contents("/etc/nanosize.txt")) . "\\n"; } diff --git a/usr/local/www/widgets/widgets/system_information.widget.php b/usr/local/www/widgets/widgets/system_information.widget.php index 6143ac1..231f2ee 100644 --- a/usr/local/www/widgets/widgets/system_information.widget.php +++ b/usr/local/www/widgets/widgets/system_information.widget.php @@ -66,13 +66,12 @@ if ($_REQUEST['getupdatestatus']) { echo "<br /><br />Unable to check for updates."; } else { $current_installed_buildtime = trim(file_get_contents("/etc/version.buildtime")); - $current_installed_version = trim(file_get_contents("/etc/version")); if (!$remote_version) { echo "<br /><br />Unable to check for updates."; } else { $needs_system_upgrade = false; - if (pfs_version_compare($current_installed_buildtime, $current_installed_version, $remote_version) == -1) { + if (pfs_version_compare($current_installed_buildtime, $g['product_version'], $remote_version) == -1) { 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 "\n<script type=\"text/javascript\">\n"; echo "//<![CDATA[\n"; @@ -124,7 +123,7 @@ $filesystems = get_mounted_filesystems(); <tr> <td width="25%" valign="top" class="vncellt"><?=gettext("Version");?></td> <td width="75%" class="listr"> - <strong><?php readfile("/etc/version"); ?></strong> + <strong><?=$g['product_version']?></strong> (<?php echo php_uname("m"); ?>) <br /> built on <?php readfile("/etc/version.buildtime"); ?> |