From 25e560fdaa85906f6e8c675ea817b0a2674e44e4 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Fri, 31 Dec 2021 16:34:19 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B04558=20Fix=20possible=20PHP=20notice=20i?= =?UTF-8?q?n=20\CMDBSource::StartTransaction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/cmdbsource.class.inc.php | 6 +++--- core/log.class.inc.php | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/cmdbsource.class.inc.php b/core/cmdbsource.class.inc.php index cfb0cbd9e..f77d024cb 100644 --- a/core/cmdbsource.class.inc.php +++ b/core/cmdbsource.class.inc.php @@ -790,14 +790,14 @@ class CMDBSource private static function StartTransaction() { $aStackTrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT , 3); - $sCaller = 'From '.$aStackTrace[1]['file'].'('.$aStackTrace[1]['line'].'): '.$aStackTrace[2]['class'].'->'.$aStackTrace[2]['function'].'()'; + $bHasExistingTransactions = self::IsInsideTransaction(); if (!$bHasExistingTransactions) { - IssueLog::Trace("START TRANSACTION $sCaller", 'cmdbsource'); + IssueLog::Trace("START TRANSACTION was sent to the DB", LogChannels::CMDBSOURCE, ['stacktrace' => $aStackTrace]); self::DBQuery('START TRANSACTION'); } else { - IssueLog::Trace("Ignore nested (".self::$m_iTransactionLevel.") START TRANSACTION $sCaller", 'cmdbsource'); + IssueLog::Trace("START TRANSACTION ignored as a transaction is already opened", LogChannels::CMDBSOURCE, ['stacktrace' => $aStackTrace]); } self::AddTransactionLevel(); diff --git a/core/log.class.inc.php b/core/log.class.inc.php index 739db5082..a7f7e07f1 100644 --- a/core/log.class.inc.php +++ b/core/log.class.inc.php @@ -539,10 +539,11 @@ class FileLog */ class LogChannels { + const APC = 'apc'; + const CMDBSOURCE = 'cmdbsource'; const DEADLOCK = 'DeadLock'; const INLINE_IMAGE = 'InlineImage'; const PORTAL = 'portal'; - const APC = 'apc'; }