(Retrofit from trunk) N°1132 Add ContextTag on CRON background tasks (eg. "CRON:Task:<CLASS_NAME_OF_THE_CURRENT_TASK>").

Introduced for the "Mail to ticket automation" extension, so we know when a Ticket is created/updated from an email.

SVN:2.4[5182]
This commit is contained in:
Guillaume Lajarige
2017-12-29 09:59:37 +00:00
parent e6072cd8b6
commit 96288db97b

View File

@@ -74,6 +74,10 @@ function RunTask($oProcess, BackgroundTask $oTask, $oStartDate, $iTimeLimit)
{
$oNow = new DateTime();
$fStart = microtime(true);
$oCtx = new ContextTag('CRON:Task:'.$oTask->Get('class_name'));
$sMessage = "";
$oExceptionToThrow = null;
try
{
$sMessage = $oProcess->Process($iTimeLimit);
@@ -114,6 +118,8 @@ function RunTask($oProcess, BackgroundTask $oTask, $oStartDate, $iTimeLimit)
$oTask->Set('next_run_date', $oPlannedStart->format('Y-m-d H:i:s'));
$oTask->DBUpdate();
unset($oCtx);
return $sMessage;
}