From e7a4890ee89b8b4cd5e33626b404fdbcce27a946 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Thu, 12 Sep 2019 16:12:28 +0200 Subject: [PATCH] added human readable ttl --- classes/cronlog-renderer.class.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/classes/cronlog-renderer.class.php b/classes/cronlog-renderer.class.php index cfd3453..adc85eb 100644 --- a/classes/cronlog-renderer.class.php +++ b/classes/cronlog-renderer.class.php @@ -100,7 +100,7 @@ class cronlogrenderer extends cronlog{ $aErrors[]='outdated since ' . date("Y-m-d H:i", $iNextRunErr) . ' (+'.$this->_iExpiredJobsFailAfter.'min)'; } if($aEntry['SCRIPTRC']>0){ - $aErrors[]='exitcode is '.$aEntry['SCRIPTRC'].' (<>0)'; + $aErrors[]='exitcode is '.(int)$aEntry['SCRIPTRC'].' (<>0)'; } if(!$aEntry['SCRIPTLABEL']){ $aErrors[]='no label?'; @@ -113,6 +113,16 @@ class cronlogrenderer extends cronlog{ $iOK++; } + // human readable TTL value ... SCRIPTTTL is in [min] + $sTtlHr=''; + if((int)$aEntry['SCRIPTTTL']>60*24*3){ + $sTtlHr.='='.round((int)$aEntry['SCRIPTTTL']/60/24).'d '; + } else if((int)$aEntry['SCRIPTTTL']>60*3){ + $sTtlHr.='='.round((int)$aEntry['SCRIPTTTL']/60).'h'; + } + $sTtlHr=$sTtlHr ? '('.$sTtlHr.')' : ''; + + // render table of last logfile per cron job $sHtml.='<tr onclick="showFile(\''.$aEntry['logfile'].'\');" title="Klick=['.$aEntry['logfile'].'] anzeigen ">' . '<td>'.date("Y-m-d H:i:s", $aEntry['SCRIPTSTARTTIME']).'</td>' // . '<td>'.$aEntry['SCRIPTNAME'].'</td>' @@ -128,6 +138,7 @@ class cronlogrenderer extends cronlog{ .($aEntry['SCRIPTTTL']<$this->_iMinTtl ? ' class="message-warning" title="(using minimal TTL = '.$this->_iMinTtl.' min)"' : '') . '>' .$aEntry['SCRIPTTTL'] + .$sTtlHr .'</td>' . '<td class="'.($aEntry['SCRIPTRC']>0 ? 'message-error' : 'message-ok' ).'">' .$aEntry['SCRIPTRC'] @@ -136,7 +147,7 @@ class cronlogrenderer extends cronlog{ ? ($iNextRunErr < date("U") ? 'message-error' : 'message-warning') : '' ).'">' . date("Y-m-d H:i", $iNextRun).'</td>' - . '<td'.(count($aErrors) ? ' class="message-error" title="'.implode("\n", $aErrors).'"' : '' ).'>' + . '<td'.(count($aErrors) ? ' class="message-error" title="- '.implode("\n- ", $aErrors).'"' : '' ).'>' // .(count($aErrors) ? 'FEHLER:<br>*'.implode('<br>*', $aErrors) : 'OK').'</td>' .(count($aErrors) ? 'FEHLER' : 'OK').'</td>' // . '<td><button onclick="showFile(\''.$aEntry['logfile'].'\');">Ansehen</button></td>' -- GitLab