Only add sofia global settings that are not in the database
This commit is contained in:
parent
ccf59f4a0c
commit
c0946a03ce
|
|
@ -2,6 +2,12 @@
|
|||
|
||||
if ($domains_processed == 1) {
|
||||
|
||||
//get all of the sofia global default settings
|
||||
$sql = "select sofia_global_setting_uuid ";
|
||||
$sql .= "from v_sofia_global_settings \n";
|
||||
$database = new database;
|
||||
$sofia_global_settings = $database->select($sql, null, 'all');
|
||||
|
||||
//build array
|
||||
$x = 0;
|
||||
$array['sofia_global_settings'][$x]['sofia_global_setting_uuid'] = '9a0e83b3-e71c-4a9a-9f1c-680d32f756f8';
|
||||
|
|
@ -28,6 +34,20 @@ if ($domains_processed == 1) {
|
|||
$array['sofia_global_settings'][$x]['global_setting_enabled'] = 'false';
|
||||
$array['sofia_global_settings'][$x]['global_setting_description'] = '';
|
||||
|
||||
//removes settings from the array that are already in the database
|
||||
$x = 0;
|
||||
foreach($sofia_global_settings as $row) {
|
||||
$x = 0;
|
||||
foreach ($array['sofia_global_settings'] as $sub_row) {
|
||||
if ($row['sofia_global_setting_uuid'] == $sub_row['sofia_global_setting_uuid']) {
|
||||
unset($array['sofia_global_settings'][$x]);
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
|
||||
//add settings that are not in the database
|
||||
if (count($array['sofia_global_settings']) > 0) {
|
||||
//grant temporary permissions
|
||||
$p = new permissions;
|
||||
$p->add('sofia_global_setting_add', 'temp');
|
||||
|
|
@ -43,4 +63,6 @@ if ($domains_processed == 1) {
|
|||
$p->delete('sofia_global_setting_add', 'temp');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue