Skip to content
Snippets Groups Projects

OP#7365 PHP-8.1 - Upgrade - cronlog Viewer (monitors.ascii)https://projects.iml.unibe.ch/work_packages/7365

Merged Hahn Axel (hahn) requested to merge freshup-php into master
4 files
+ 47
7
Compare changes
  • Side-by-side
  • Inline

Files

+ 22
1
@@ -44,6 +44,13 @@ class cronlogrenderer extends cronlog
*/
protected int $_iMinTime4Timeline = 60;
/**
* Max count of entries in history table to prevent freezing of the screen
* when displaying a lot of entries, eg all logs of 100+ servers
* @var int
*/
protected int $_iHistoryLimit = 1000;
/**
* Show date of last data and last access; used in rendering methods to display it on top
* @param integer $iLast unix timestamp of last log entry
@@ -55,9 +62,10 @@ class cronlogrenderer extends cronlog
return '';
}
$iAge = round((date('U') - $iLast) / 60);
$sAge = ($iAge > 60*24 ? '<span class="message-error">'.$iAge.'</span>' : $iAge);
return '<div class="accessandage">'
. sprintf($this->t("request-time"), date("Y-m-d H:i:s")) . '<br>'
. sprintf($this->t("last-entry"), $iAge)
. sprintf($this->t("last-entry"), $sAge)
. '</div>'
;
}
@@ -365,12 +373,25 @@ class cronlogrenderer extends cronlog
$aData = $this->getServerJobHistory();
}
// sort by starting time - especially before cutting the list
$aTmp=[];
foreach($aData as $sKey => $aEntry) {
$aTmp[$aEntry['start'].'__'.$aEntry['host'].'__'.$aEntry['job']]=$aEntry;
}
krsort($aTmp);
$aData = array_values($aTmp);
$sTblHead = '';
$iOK = 0;
$iErrors = 0;
$iLast = false;
$iCounter = 0;
// job=dok-kvm-instances:host=kalium:start=1538358001:end=1538358001:exectime=0:ttl=60:rc=0
foreach ($aData as $aEntry) {
$iCounter++;
if($iCounter>$this->_iHistoryLimit) {
break;
}
if (!$sTblHead) {
foreach ([
$this->t("col-starting-time"),
Loading