mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 07:12:26 +02:00
(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:
@@ -74,6 +74,10 @@ function RunTask($oProcess, BackgroundTask $oTask, $oStartDate, $iTimeLimit)
|
|||||||
{
|
{
|
||||||
$oNow = new DateTime();
|
$oNow = new DateTime();
|
||||||
$fStart = microtime(true);
|
$fStart = microtime(true);
|
||||||
|
$oCtx = new ContextTag('CRON:Task:'.$oTask->Get('class_name'));
|
||||||
|
|
||||||
|
$sMessage = "";
|
||||||
|
$oExceptionToThrow = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$sMessage = $oProcess->Process($iTimeLimit);
|
$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->Set('next_run_date', $oPlannedStart->format('Y-m-d H:i:s'));
|
||||||
$oTask->DBUpdate();
|
$oTask->DBUpdate();
|
||||||
|
unset($oCtx);
|
||||||
|
|
||||||
return $sMessage;
|
return $sMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user