Update FusionPBX version only when changed.

This commit is contained in:
FusionPBX 2022-09-22 11:23:51 -06:00 committed by GitHub
parent 3c18286c69
commit 6f2a8df168
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 23 deletions

View File

@ -26,23 +26,26 @@
if ($domains_processed == 1) {
//unset array if it exists
if (isset($array)) { unset($array); }
//update the software table
$sql = "select count(*) from v_software ";
$sql = "select software_version from v_software ";
$database = new database;
$num_rows = $database->select($sql, null, 'column');
if ($num_rows == 0) {
if ($array['software'][0]['software_version'] != software::version()) {
$software_version = $database->select($sql, null, 'column');
if ($software_version == '') {
$array['software'][0]['software_uuid'] = '7de057e7-333b-4ebf-9466-315ae7d44efd';
$array['software'][0]['software_name'] = 'FusionPBX';
$array['software'][0]['software_url'] = 'https://www.fusionpbx.com';
$array['software'][0]['software_version'] = software::version();
}
}
else {
elseif ($software_version != software::version()) {
$array['software'][0]['software_uuid'] = '7de057e7-333b-4ebf-9466-315ae7d44efd';
$array['software'][0]['software_version'] = software::version();
}
//save the data in the array
if (is_array($array) && count($array) > 0) {
//add the temporary permission
$p = new permissions;
$p->add("software_add", 'temp');
@ -58,6 +61,7 @@ if ($domains_processed == 1) {
//remove the temporary permission
$p->delete("software_add", 'temp');
$p->delete("software_edit", 'temp');
}
}