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