From a2992782e36854a59ab1ef860e87c72cd3eb066d Mon Sep 17 00:00:00 2001 From: minotaur01 Date: Thu, 8 Sep 2016 23:28:26 -0400 Subject: [PATCH] TFTP Service v1.0.9 (#1905) Fixed bug in app_defaults that recreated new setting eacg upgrade --- app/tftp/app_defaults.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/tftp/app_defaults.php b/app/tftp/app_defaults.php index 4e2a4324c7..90aac78fd7 100644 --- a/app/tftp/app_defaults.php +++ b/app/tftp/app_defaults.php @@ -60,22 +60,21 @@ unset ($prep_statement, $sql); //find the missing default settings - $x = 0; + $missing = []; foreach ($array as $setting) { $found = false; - $missing[$x] = $setting; 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; - //remove items from the array that were found - unset($missing[$x]); + break; } } - $x++; + + if (!$found) $missing[] = $setting; } //add the missing default settings - if (count($missing) > 0) foreach ($missing as $row) { + foreach ($missing as $row) { //add the default settings $orm = new orm; $orm->name('default_settings');