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

use config file to customize

parent 5404ec73
No related branches found
No related tags found
No related merge requests found
/data/
/nbproject/
/cronjobs.html
/winscp.rnd
\ No newline at end of file
/winscp.rnd
config/inc_cronlog.php
<?php
require_once 'cronlog.class.php';
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of cronlog-renderer
* central cronlog viewer
*
* cronlog-renderer contains visual methods to render html
* @see cronlog.class.php
*
* @author hahn
*/
......
<?php
/**
* Description of cronlog
* central cronlog viewer
*
* cronlog contains non visual methods
* @see cronlog-renderer.class.php
*
* @author hahn
*/
......@@ -9,27 +11,26 @@
class cronlog {
protected $_sDataDir = "__DIR__/data";
protected $_sDataDir = "__APPDIR__/data";
protected $_iTtlCache = 60; // in sec
protected $_aSkipJoblogs = array();
protected $_aServers = false;
protected $_sActiveServer = false;
protected $_sFileFilter_serverjoblog = '*joblog*.done';
protected $_sFileFilter_serverlog = '*.log';
protected $_aSkipJoblogs = array(
// 'dok-kvm-instances',
'sync-log-2-lithium',
);
public function __construct() {
if (file_exists(__DIR__.'/cronlog_cfg.php')){
include(__DIR__.'/cronlog_cfg.php');
if (file_exists(__DIR__.'/../config/inc_cronlog.php')){
$aCfgTemp=include(__DIR__.'/../config/inc_cronlog.php');
$this->_sDataDir = isset($aCfgTemp['sDatadir']) ? $aCfgTemp['sDatadir'] : $this->_sDataDir;
$this->_iTtlCache = isset($aCfgTemp['iTtlCache']) ? (int)$aCfgTemp['iTtlCache'] : $this->_iTtlCache;
$this->_aSkipJoblogs = isset($aCfgTemp['aHidelogs']) && is_array($aCfgTemp['aHidelogs']) ? $aCfgTemp['aHidelogs'] : $this->_aSkipJoblogs;
}
$this->_sDataDir = str_replace("__DIR__", dirname(dirname(__FILE__)), $this->_sDataDir);
$this->_sDataDir = str_replace("__APPDIR__", dirname(dirname(__FILE__)), $this->_sDataDir);
$this->_sDataDir = str_replace('\\', '/', $this->_sDataDir);
$this->getServers();
......@@ -112,7 +113,7 @@ class cronlog {
$this->_aServers=array();
// echo "DEBUG DATADIR: " . $this->_sDataDir."<br>";
if (!is_dir($this->_sDataDir)){
echo "WARNING: no data. variable _sDataDir is wrong (or somehting is not mounted).<br>";
echo "WARNING: no data. Check sDatadir in the config and set it to an existing directory.<br>";
die();
}
......
<?php
$sLithiumDir='/var/www/cronlogs';
if(is_dir($sLithiumDir)){
$this->_sDataDir = $sLithiumDir;
}
\ No newline at end of file
<?php
/**
* CONFIG FILE
*
* it is included by classes/cronlog.class.php
*/
return array(
// starting directory with all servers cronwrapper logs
'sDatadir'=>'__APPDIR__/data',
// caching time for infos in the browser
'iTtlCache'=>0,
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment