From 0fe2f2037539bce23d3352f4a3cc7f51961bb3f4 Mon Sep 17 00:00:00 2001 From: fusionate Date: Wed, 17 Jan 2024 21:33:23 +0000 Subject: [PATCH] Domains - Delete: Fix issue deleting multiple domains at once. --- resources/classes/domains.php | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/resources/classes/domains.php b/resources/classes/domains.php index 9d6705a2b8..bedc63dd91 100644 --- a/resources/classes/domains.php +++ b/resources/classes/domains.php @@ -81,7 +81,6 @@ if (!class_exists('domains')) { //delete multiple records if (is_array($records) && @sizeof($records) != 0) { //build the delete array - $d = 0; foreach ($records as $record) { //add to the array if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) { @@ -144,9 +143,9 @@ if (!class_exists('domains')) { if (isset($app['db'])) foreach ($app['db'] as $row) { if (is_array($row['table']['name'])) { $table_name = $row['table']['name']['text']; - echo "
";
-														print_r($table_name);
-														echo "
\n";
+														if (defined('STDIN')) {
+															echo "
".print_r($table_name, 1)."
\n";
+														}
 													}
 													else {
 														$table_name = $row['table']['name'];
@@ -255,16 +254,11 @@ if (!class_exists('domains')) {
 										//apply settings reminder
 											$_SESSION["reload_xml"] = true;
 
-										//clear the domains session array to update it
-											unset($_SESSION["domains"]);
-											unset($_SESSION['domain']);
-											unset($_SESSION['switch']);
+										//remove the domain from domains session array
+											unset($_SESSION["domains"][$id]);
 
-										//remove the domain and save to transactions
-											$domain_array['domains'][$d]['domain_uuid'] = $id;
-
-										//increment the id
-											$d++;
+										//add domain uuid to array for deletion below
+											$domain_array['domains'][] = ['domain_uuid'=>$id];
 									}
 							}
 
@@ -275,10 +269,12 @@ if (!class_exists('domains')) {
 									$database->app_name = $this->app_name;
 									$database->app_uuid = $this->app_uuid;
 									$database->delete($domain_array);
-									unset($array);
 
 								//set message
 									message::add($text['message-delete']);
+
+								//reload default/domain settings
+									$this->set();
 							}
 							unset($records);
 					}