Revise update check to provide a more consistent version string, and to provide it in JSON format

(cherry picked from commit 8191650200)
This commit is contained in:
Steve Beaver 2019-08-28 14:03:38 -04:00 committed by jim-p
parent 8c50180097
commit e553d3d03f

View File

@ -1472,7 +1472,6 @@ function update_repos() {
// Gather some information about the system so the proper repo can be returned
$nid = file_get_contents($idfile);
$serial = system_get_serial();
$arch = php_uname('p');
$base_pkg = get_base_pkg_name();
@ -1486,10 +1485,19 @@ function update_repos() {
}
}
$version = $pkg_info['installed_version'];
// Compose a version string in JSON format
$os = php_uname('s');
$osver = php_uname('r');
$v = php_uname('v');
$ed = (strpos($v, 'factory') !== false) ? "Factory":"Community";
$version = "{\"os\":\"" . $os . "\",\"osver\":\"" . $osver . "\",\"prod\":\"pfSense\"," . "\"ver\":\"" . $info[0]['version'] . "\",\"ed\":\"" . $ed . "\"}";
// Compose an architecture string in JSON format
$arch = php_uname('m');
$locale = $config['system']['language'];
// Architecture comes from the last word in the uname output
$arch = array_pop(explode(' ', php_uname('p')));
$post = ['uid' => $nid,
'language' => $locale,