Update FusionPBX version only when changed.
This commit is contained in:
parent
3c18286c69
commit
6f2a8df168
|
|
@ -26,38 +26,42 @@
|
||||||
|
|
||||||
if ($domains_processed == 1) {
|
if ($domains_processed == 1) {
|
||||||
|
|
||||||
|
//unset array if it exists
|
||||||
|
if (isset($array)) { unset($array); }
|
||||||
|
|
||||||
//update the software table
|
//update the software table
|
||||||
$sql = "select count(*) from v_software ";
|
$sql = "select software_version from v_software ";
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$num_rows = $database->select($sql, null, 'column');
|
$software_version = $database->select($sql, null, 'column');
|
||||||
if ($num_rows == 0) {
|
if ($software_version == '') {
|
||||||
if ($array['software'][0]['software_version'] != software::version()) {
|
$array['software'][0]['software_uuid'] = '7de057e7-333b-4ebf-9466-315ae7d44efd';
|
||||||
$array['software'][0]['software_uuid'] = '7de057e7-333b-4ebf-9466-315ae7d44efd';
|
$array['software'][0]['software_name'] = 'FusionPBX';
|
||||||
$array['software'][0]['software_name'] = 'FusionPBX';
|
$array['software'][0]['software_url'] = 'https://www.fusionpbx.com';
|
||||||
$array['software'][0]['software_url'] = 'https://www.fusionpbx.com';
|
$array['software'][0]['software_version'] = software::version();
|
||||||
$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_uuid'] = '7de057e7-333b-4ebf-9466-315ae7d44efd';
|
||||||
$array['software'][0]['software_version'] = software::version();
|
$array['software'][0]['software_version'] = software::version();
|
||||||
}
|
}
|
||||||
|
|
||||||
//add the temporary permission
|
//save the data in the array
|
||||||
$p = new permissions;
|
if (is_array($array) && count($array) > 0) {
|
||||||
$p->add("software_add", 'temp');
|
//add the temporary permission
|
||||||
$p->add("software_edit", 'temp');
|
$p = new permissions;
|
||||||
|
$p->add("software_add", 'temp');
|
||||||
|
$p->add("software_edit", 'temp');
|
||||||
|
|
||||||
//save the data
|
//save the data
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$database->app_name = 'software';
|
$database->app_name = 'software';
|
||||||
$database->app_uuid = 'b88c795f-7dea-4fc8-9ab7-edd555242cff';
|
$database->app_uuid = 'b88c795f-7dea-4fc8-9ab7-edd555242cff';
|
||||||
$database->save($array, false);
|
$database->save($array, false);
|
||||||
unset($array);
|
unset($array);
|
||||||
|
|
||||||
//remove the temporary permission
|
//remove the temporary permission
|
||||||
$p->delete("software_add", 'temp');
|
$p->delete("software_add", 'temp');
|
||||||
$p->delete("software_edit", 'temp');
|
$p->delete("software_edit", 'temp');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue