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

Files

+ 11
6
@@ -33,7 +33,7 @@ require_once 'cronlog.class.php';
* @license GNU GPL 3.0
* @author Axel Hahn <axel.hahn@iml.unibe.ch>
*
* 2024-09-20 <axel.hahn@unibe.ch> added type declarations; update php docs
* 2024-10-01 <axel.hahn@unibe.ch> added type declarations; update php docs
*/
class cronlogrenderer extends cronlog
{
@@ -66,6 +66,10 @@ class cronlogrenderer extends cronlog
return '<div class="accessandage">'
. sprintf($this->t("request-time"), date("Y-m-d H:i:s")) . '<br>'
. sprintf($this->t("last-entry"), $sAge)
.($iAge > 60*24
? " <a href=\"?deleteserverlogs=$this->_sActiveServer\" class=\"btn btn-danger\">Delete server</a>"
: ''
)
. '</div>'
;
}
@@ -342,7 +346,7 @@ class cronlogrenderer extends cronlog
return '';
}
$sReturn = '';
$sServer = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : false;
$sServer = isset($_SERVER['SERVER_NAME']) ?? false;
$sReturn .= '<li class="nav-item"><a class="nav-link nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a></li>'
. '<li class="nav-item d-none d-sm-inline-block"><a href="#" class="nav-link">' . $this->t('instances') . ':</a></li>';
@@ -360,7 +364,7 @@ class cronlogrenderer extends cronlog
* @param array $aData result of $oCL->getServerLogs()
* @return string
*/
public function renderJoblist(array $aData = []): string
public function renderHistoryTable(array $aData = []): string
{
$sTaskId = __FUNCTION__ . '-' . $this->_sActiveServer;
$sHtml = $this->_getCacheData($sTaskId);
@@ -381,6 +385,7 @@ class cronlogrenderer extends cronlog
krsort($aTmp);
$aData = array_values($aTmp);
// render table
$sTblHead = '';
$iOK = 0;
$iErrors = 0;
@@ -482,7 +487,7 @@ class cronlogrenderer extends cronlog
*
* @return string
*/
public function renderJoblistOfAllServers(): string
public function renderHistoryOfAllServers(): string
{
$aData = [];
foreach (array_keys($this->getServers()) as $sServer) {
@@ -490,7 +495,7 @@ class cronlogrenderer extends cronlog
$aData = array_merge($aData, $this->getServerJobHistory());
}
$this->setServer('ALL');
return $this->renderJoblist($aData);
return $this->renderHistoryTable($aData);
}
/**
@@ -593,7 +598,7 @@ class cronlogrenderer extends cronlog
var timeline = new vis.Timeline(container, items, options);
// set focus to newest jobs
timeline.moveTo("'.date("Y-m-d H:i:s", time()-60*60*24*4).'");
// timeline.moveTo("'.date("Y-m-d H:i:s", time()-60*60*24*4).'");
// fix: some timelines do not properly work ... but I make them visible
$(\'#' . $sDivId . ' .vis-timeline\').css(\'visibility\', \'visible\');
Loading