Change log file folder

This commit is contained in:
2023-08-06 13:24:00 +02:00
parent dd4469c349
commit e1cf78b992
6 changed files with 16 additions and 9 deletions

View File

@@ -45,7 +45,7 @@ class Db extends PhpObject
$this->asConf = $asConf; $this->asConf = $asConf;
$this->asOptions = $asOptions; $this->asOptions = $asOptions;
parent::__construct(__FILE__, Settings::DEBUG); parent::__construct(__FILE__);
$this->oConnection = new \mysqli($this->getConf('server'), $this->getConf('user'), $this->getConf('pass')); $this->oConnection = new \mysqli($this->getConf('server'), $this->getConf('user'), $this->getConf('pass'));
$this->syncPhpParams($this->getConf('encoding')); $this->syncPhpParams($this->getConf('encoding'));

View File

@@ -23,7 +23,7 @@ class Feed extends PhpObject
*/ */
public function __construct($asChannel=array(), $asItems=array()) public function __construct($asChannel=array(), $asItems=array())
{ {
parent::__construct(__CLASS__, Settings::DEBUG); parent::__construct(__CLASS__);
if(!empty($asChannel) && !array_key_exists('link', $asChannel)) if(!empty($asChannel) && !array_key_exists('link', $asChannel))
{ {
$asChannel['link'] = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'].'/rss'; $asChannel['link'] = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'].'/rss';

View File

@@ -48,9 +48,9 @@ abstract class Main extends PhpObject
/** /**
* Main constructor * Main constructor
*/ */
public function __construct($sProcessPage, $bDb=true, $sFile=__FILE__, $sTimeZone='') public function __construct($sProcessPage, $bDb=true, $sTimeZone='', $sLogPath='')
{ {
parent::__construct($sFile, Settings::DEBUG); parent::__construct(get_class($this), Settings::DEBUG, PhpObject::MODE_FILE, $sLogPath);
$this->setContext($sProcessPage, $sTimeZone); $this->setContext($sProcessPage, $sTimeZone);

View File

@@ -32,7 +32,7 @@ class Mask extends PhpObject
public function __construct($sFileName='', Translator $oLang=null, $sTimezone = '') public function __construct($sFileName='', Translator $oLang=null, $sTimezone = '')
{ {
//init //init
parent::__construct(__FILE__, Settings::DEBUG); parent::__construct(__CLASS__);
$this->sMaskName = ''; $this->sMaskName = '';
$this->sFilePath = ''; $this->sFilePath = '';
$this->sMask = ''; $this->sMask = '';

View File

@@ -12,6 +12,7 @@ class PhpObject
{ {
//Log file name //Log file name
const LOG_FILENAME = 'log.html'; const LOG_FILENAME = 'log.html';
private $sLogPath;
//Message types //Message types
const NOTICE_TAB = 'Notice'; const NOTICE_TAB = 'Notice';
@@ -31,13 +32,14 @@ class PhpObject
private $sChildClass; private $sChildClass;
private $bDebug; private $bDebug;
function __construct($sClass='', $bDebug=false, $iExtractMode=self::MODE_FILE) function __construct($sClass='', $bDebug=Settings::DEBUG, $iExtractMode=self::MODE_FILE, $sLogPath='')
{ {
$this->asMessageStack = array(); $this->asMessageStack = array();
$this->resetMessageStack(); $this->resetMessageStack();
$this->setDebug($bDebug); $this->setDebug($bDebug);
$this->setExtractMode($iExtractMode); $this->setExtractMode($iExtractMode);
$this->sChildClass = $sClass; $this->sChildClass = $sClass;
$this->setLogPath($sLogPath);
} }
public function setExtractMode($iExtractMode) { public function setExtractMode($iExtractMode) {
@@ -54,10 +56,15 @@ class PhpObject
{ {
return $this->bDebug; return $this->bDebug;
} }
private function setLogPath($sLogPath) {
if($sLogPath == '') $sLogPath = defined('Settings::LOG_FOLDER')?Settings::LOG_FOLDER:dirname(__FILE__);
$this->sLogPath = $sLogPath.DIRECTORY_SEPARATOR.self::LOG_FILENAME;
}
private static function getLogPath() private function getLogPath()
{ {
return dirname(__FILE__).DIRECTORY_SEPARATOR.self::LOG_FILENAME; return $this->sLogPath;
} }
private function resetMessageStack($sType=self::ALL_TAB) private function resetMessageStack($sType=self::ALL_TAB)

View File

@@ -27,7 +27,7 @@ class Translator extends PhpObject
*/ */
public function __construct($sLang='', $sDefaultLang='') public function __construct($sLang='', $sDefaultLang='')
{ {
parent::__construct(__FILE__, Settings::DEBUG); parent::__construct(__FILE__);
$this->asLanguages = array(); $this->asLanguages = array();
$this->asTranslations = array(); $this->asTranslations = array();
$this->loadLanguages(); $this->loadLanguages();