From 5779ade6707ba530517da239d9ec3fc751d17d83 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Fri, 31 Jul 2015 10:03:34 -0300 Subject: Introduce a new item to $g global, 'product_version' and stop reading /etc/version all around --- etc/inc/pfsense-utils.inc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'etc/inc/pfsense-utils.inc') diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 22b0be0..93719ad 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -802,7 +802,7 @@ function check_firmware_version($tocheck = "all", $return_php = true) { } $version = php_uname('r'); $version = explode('-', $version); - $rawparams = array("firmware" => array("version" => trim(file_get_contents('/etc/version'))), + $rawparams = array("firmware" => array("version" => $g['product_version']), "kernel" => array("version" => $version[0]), "base" => array("version" => $version[0]), "platform" => trim(file_get_contents('/etc/platform')), @@ -841,7 +841,7 @@ function host_firmware_version($tocheck = "") { $os_version = trim(substr(php_uname("r"), 0, strpos(php_uname("r"), '-'))); return array( - "firmware" => array("version" => trim(file_get_contents('/etc/version', " \n"))), + "firmware" => array("version" => $g['product_version']), "kernel" => array("version" => $os_version), "base" => array("version" => $os_version), "platform" => trim(file_get_contents('/etc/platform', " \n")), @@ -1773,9 +1773,9 @@ function download_file($url, $destination, $verify_ssl = true, $connect_timeout curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); if (!isset($config['system']['host_uuid'])) { - curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version") . ' : ' . get_single_sysctl('kern.hostuuid'))); + curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . $g['product_version'] . ' : ' . get_single_sysctl('kern.hostuuid')); } else { - 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']); } if (!empty($config['system']['proxyurl'])) { @@ -1819,9 +1819,9 @@ function download_file_with_progress_bar($url_file, $destination_file, $readbody curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $connect_timeout); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); if (!isset($config['system']['host_uuid'])) { - curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version") . ' : ' . get_single_sysctl('kern.hostuuid'))); + curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . $g['product_version'] . ' : ' . get_single_sysctl('kern.hostuuid')); } else { - 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']); } if (!empty($config['system']['proxyurl'])) { -- cgit v1.1