diff --git a/core/ormstopwatch.class.inc.php b/core/ormstopwatch.class.inc.php index edbe1f5d5..66387a99d 100644 --- a/core/ormstopwatch.class.inc.php +++ b/core/ormstopwatch.class.inc.php @@ -1,5 +1,5 @@ ComputeDuration($oHostObject, $oAttDef, $this->iLastStart, time()); - $aProperties['Elapsed'] = $this->iTimeSpent.' + '.$iElapsedTemp.' s + '; + $aProperties['Elapsed'] = 'running '; } $aProperties['Started'] = $oAttDef->SecondsToDate($this->iStarted); @@ -183,7 +182,7 @@ class ormStopWatch } $aProperties[$iPercent.'%'] = $sThresholdDesc; } - $sRes = ""; + $sRes = "
"; $sRes .= ""; foreach ($aProperties as $sProperty => $sValue) { @@ -387,9 +386,9 @@ class CheckStopWatchThresholds implements iBackgroundProcess public function Process($iTimeLimit) { + $aList = array(); foreach (MetaModel::GetClasses() as $sClass) { - $aList = array(); foreach (MetaModel::ListAttributeDefs($sClass) as $sAttCode => $oAttDef) { if ($oAttDef instanceof AttributeStopWatch) @@ -398,8 +397,8 @@ class CheckStopWatchThresholds implements iBackgroundProcess { $iPercent = $aThresholdData['percent']; // could be different than the index ! - $sExpression = "SELECT $sClass WHERE {$sAttCode}_laststart AND {$sAttCode}_{$iThreshold}_triggered = 0 AND {$sAttCode}_{$iThreshold}_deadline < NOW()"; - //echo $sExpression."
\n"; + $sNow = date('Y-m-d H:i:s'); + $sExpression = "SELECT $sClass WHERE {$sAttCode}_laststart AND {$sAttCode}_{$iThreshold}_triggered = 0 AND {$sAttCode}_{$iThreshold}_deadline < '$sNow'"; $oFilter = DBObjectSearch::FromOQL($sExpression); $oSet = new DBObjectSet($oFilter); while ((time() < $iTimeLimit) && ($oObj = $oSet->Fetch())) @@ -407,7 +406,6 @@ class CheckStopWatchThresholds implements iBackgroundProcess $sClass = get_class($oObj); $aList[] = $sClass.'::'.$oObj->GetKey().' '.$sAttCode.' '.$iThreshold; - //echo $sClass.'::'.$oObj->GetKey().' '.$sAttCode.' '.$iThreshold."\n"; // Execute planned actions // @@ -416,7 +414,6 @@ class CheckStopWatchThresholds implements iBackgroundProcess $sVerb = $aActionData['verb']; $aParams = $aActionData['params']; $sParams = implode(', ', $aParams); - //echo "Calling: $sVerb($sParams)
\n"; $aCallSpec = array($oObj, $sVerb); call_user_func_array($aCallSpec, $aParams); } @@ -438,12 +435,12 @@ class CheckStopWatchThresholds implements iBackgroundProcess // Activate any existing trigger // $sClassList = implode("', '", MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL)); - $oSet = new DBObjectSet( + $oTriggerSet = new DBObjectSet( DBObjectSearch::FromOQL("SELECT TriggerOnThresholdReached AS t WHERE t.target_class IN ('$sClassList') AND stop_watch_code=:stop_watch_code AND threshold_index = :threshold_index"), array(), // order by array('stop_watch_code' => $sAttCode, 'threshold_index' => $iThreshold) ); - while ($oTrigger = $oSet->Fetch()) + while ($oTrigger = $oTriggerSet->Fetch()) { $oTrigger->DoActivate($oObj->ToArgs('this')); } @@ -454,9 +451,6 @@ class CheckStopWatchThresholds implements iBackgroundProcess } $iProcessed = count($aList); - return "Triggered $iProcessed threshold(s)"; + return "Triggered $iProcessed threshold(s):".implode(", ", $aList); } } - - -?>