From b907d6237fa2e292ec8275fdbd6670f513b3d23c Mon Sep 17 00:00:00 2001 From: Michel_F <80367602+MrWaloo@users.noreply.github.com> Date: Sat, 7 Dec 2024 00:24:48 +0100 Subject: [PATCH] Performance increase while importing an equipment without removing existing commands --- core/class/eqLogic.class.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core/class/eqLogic.class.php b/core/class/eqLogic.class.php index 97d9ce588c..b38555d98a 100644 --- a/core/class/eqLogic.class.php +++ b/core/class/eqLogic.class.php @@ -1375,18 +1375,18 @@ public function import($_configuration, $_dontRemove = false) { $link_actions = array(); $arrayToRemove = []; if (isset($_configuration['commands'])) { - foreach (($this->getCmd()) as $eqLogic_cmd) { - $exists = 0; - foreach ($_configuration['commands'] as $command) { - if (isset($command['logicalId']) && $command['logicalId'] == $eqLogic_cmd->getLogicalId()) { - $exists++; + if (!$_dontRemove) { + foreach (($this->getCmd()) as $eqLogic_cmd) { + $exists = 0; + foreach ($_configuration['commands'] as $command) { + if (isset($command['logicalId']) && $command['logicalId'] == $eqLogic_cmd->getLogicalId()) { + $exists++; + } + } + if ($exists < 1) { + $arrayToRemove[] = $eqLogic_cmd; } } - if ($exists < 1) { - $arrayToRemove[] = $eqLogic_cmd; - } - } - if (!$_dontRemove) { foreach ($arrayToRemove as $cmdToRemove) { try { $cmdToRemove->remove();