From 06985d3cf21ddf631f2b9a4c8183ed1238096400 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Mon, 8 Nov 2021 16:12:38 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B04387=20synchro=5Fimport=20restore=20prev?= =?UTF-8?q?ious=20set=5Ftime=5Flimit=20call?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Was changed in b1761e04 (iTop 2.7.0) by mistake Added noinspection as the IDE warning (https://github.com/kalessil/phpinspectionsea/blob/master/docs/control-flow.md#statement-could-be-decoupled-from-foreach) seems to be a false positive ? --- synchro/synchro_import.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/synchro/synchro_import.php b/synchro/synchro_import.php index 0c065d03a..c2cfb0407 100644 --- a/synchro/synchro_import.php +++ b/synchro/synchro_import.php @@ -512,16 +512,16 @@ try $iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop'); $oMutex = new iTopMutex('synchro_import_'.$oDataSource->GetKey()); $oMutex->Lock(); - set_time_limit($iLoopTimeLimit); foreach ($aData as $iRow => $aRow) { + /** @noinspection DisconnectedForeachInstructionInspection */ + set_time_limit($iLoopTimeLimit); $sReconciliationCondition = '`primary_key` = '.CMDBSource::Quote($aRow[$iPrimaryKeyCol]); $sSelect = "SELECT COUNT(*) FROM `$sTable` WHERE $sReconciliationCondition"; $aRes = CMDBSource::QueryToArray($sSelect); $iCount = (int)$aRes[0]['COUNT(*)']; - if ($iCount === 0) - { + if ($iCount === 0) { // No record... create it // $iCountCreations++;