TFTP Service v1.0.9 (#1905)

Fixed bug in app_defaults that recreated new setting eacg upgrade
This commit is contained in:
minotaur01 2016-09-08 23:28:26 -04:00 committed by FusionPBX
parent fa0ac3f46b
commit a2992782e3
1 changed files with 6 additions and 7 deletions

View File

@ -60,22 +60,21 @@
unset ($prep_statement, $sql); unset ($prep_statement, $sql);
//find the missing default settings //find the missing default settings
$x = 0; $missing = [];
foreach ($array as $setting) { foreach ($array as $setting) {
$found = false; $found = false;
$missing[$x] = $setting;
foreach ($default_settings as $row) { foreach ($default_settings as $row) {
if (trim($row['default_setting_subcategory']) == trim($setting['default_setting_subcategory'])) { if (trim($row['default_setting_subcategory']) == trim($setting['default_setting_subcategory'])) {
$found = true; $found = true;
//remove items from the array that were found break;
unset($missing[$x]);
} }
} }
$x++;
if (!$found) $missing[] = $setting;
} }
//add the missing default settings //add the missing default settings
if (count($missing) > 0) foreach ($missing as $row) { foreach ($missing as $row) {
//add the default settings //add the default settings
$orm = new orm; $orm = new orm;
$orm->name('default_settings'); $orm->name('default_settings');