Skip to content
Snippets Groups Projects
Commit 935ac129 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch 'add-running-jobs' into 'master'

add running jobs

See merge request !13
parents 28ab961b 347e2834
No related branches found
No related tags found
1 merge request!13add running jobs
......@@ -111,7 +111,7 @@ class cronlogrenderer extends cronlog{
$sHtml='';
if(!$aData){
$aData=$this->getServersLastLog();
$aData=array_merge($this->getRunningJobs(), $this->getServersLastLog());
}
$sTblHead='';
$iOK=0;
......@@ -201,7 +201,7 @@ class cronlogrenderer extends cronlog{
}
$sColStatus='<ul>'.$sColStatus.'</ul>';
} else {
$sColStatus.=$this->t('status-ok');
$sColStatus.=($aEntry['SCRIPTRC'] ? $this->t('status-ok') : '');
}
// render table of last logfile per cron job
$sHtml.='<tr onclick="showFile(\''.$aEntry['logfile'].'\');" title="'.sprintf($this->t('row-click-show-logfile'), $aEntry['logfile']).'">'
......@@ -224,7 +224,7 @@ class cronlogrenderer extends cronlog{
.$sTtlHr
.'</td>'
. '<td class="'.($aEntry['SCRIPTRC']>0 ? 'message-error' : 'message-ok' ).'">'
.$aEntry['SCRIPTRC']
.($aEntry['SCRIPTRC'] ? $aEntry['SCRIPTRC'] : '⏳')
.'</td>'
. '<td class="'.($iNextRunWarn < date("U")
? ($iNextRunErr < date("U") ? 'message-error' : 'message-warning')
......
......@@ -53,7 +53,8 @@ class cronlog {
protected $_sActiveServer = false;
protected $_sFileFilter_serverjoblog = '*joblog*.done';
protected $_sFileFilter_serverlog = '*.log';
protected $_sFileFilter_joblog = '*.log';
protected $_sFileFilter_jobrunning = '*.log.running';
protected $_sLang = ''; // language ... read from config file
protected $_aLang = []; // language data
......@@ -101,7 +102,7 @@ class cronlog {
/**
* chaching: get the full path of directory for caching
* @return type
* @return string
*/
protected function _getCacheDir(){
return $this->_sDataDir.'/__cache';
......@@ -109,8 +110,8 @@ class cronlog {
/**
* caching: get full path of a caching item
* @param type $sTaskId
* @return type
* @param string $sTaskId
* @return string
*/
protected function _getCacheFile($sTaskId){
return $this->_getCacheDir().'/'.$sTaskId;
......@@ -118,7 +119,7 @@ class cronlog {
/**
* read logs: get full path to a servers cronjob logdata
* @return type
* @return string
*/
protected function _getServerlogDir(){
return $this->_sDataDir.'/'.$this->_sActiveServer;
......@@ -127,7 +128,7 @@ class cronlog {
/**
* caching: get cached data if they exist and aren't expired
* @param string $sTaskId
* @return boolean|array
* @return mixed boolean|array
*/
protected function _getCacheData($sTaskId){
// DISABLE CACHE return false;
......@@ -298,7 +299,24 @@ class cronlog {
public function getServersLastLog(){
$aReturn=array();
$aData=array();
foreach(glob($this->_getServerlogDir().'/'.$this->_sFileFilter_serverlog) as $sMyJobfile){
foreach(glob($this->_getServerlogDir().'/'.$this->_sFileFilter_joblog) as $sMyJobfile){
// echo "DEBUG: log file $sMyJobfile<br>";
$aData=$this->_parseLogfile($sMyJobfile);
$aData['server']=$this->_sActiveServer;
$aData['logfile']= $this->_sActiveServer.'/'.basename($sMyJobfile);
$aReturn[$aData['SCRIPTSTARTTIME'].$sMyJobfile]=$aData;
}
rsort($aReturn);
return $aReturn;
}
/**
* get logs from jobfilea of the current or given server
* @return array
*/
public function getRunningJobs(){
$aReturn=array();
$aData=array();
foreach(glob($this->_getServerlogDir().'/'.$this->_sFileFilter_jobrunning) as $sMyJobfile){
// echo "DEBUG: log file $sMyJobfile<br>";
$aData=$this->_parseLogfile($sMyJobfile);
$aData['server']=$this->_sActiveServer;
......@@ -311,6 +329,8 @@ class cronlog {
/**
* translate ... get a language specific text of a given key
* @param string $id id of language text
* @return string
*/
public function t($id){
return ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment