Skip to content

Commit

Permalink
Merge pull request #33 from HZKnight/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
lucliscio authored Nov 17, 2023
2 parents 517f908 + 2727e57 commit d3bfe2c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Experience/core/config/econfigmanager.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private function set_param2($param,$val){
}

private function set_param3($section,$param,$val){
if (array_key_exists($section, $this->cfgJson)){
if (!array_key_exists($section, $this->cfgJson)){
$this->cfgJson[$section] = array();
}
$this->cfgJson[$section][$param] = $val;
Expand All @@ -141,7 +141,7 @@ private function set_param3($section,$param,$val){
}

private function save_cfg(){
$status = file_put_contents($this->cfgfile, json_encode($this->cfgJson));
$status = file_put_contents($this->cfgfile, json_encode($this->cfgJson, JSON_PRETTY_PRINT));
if(!$status)throw new ConfigException(dgettext("Elang","Config file isn't wirittable"),123);
}

Expand Down
25 changes: 21 additions & 4 deletions src/Experience/core/logger/appenders/appender_file.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ public function __construct($logname, EConfigManager $cfg){

$this->logfile_basedir = $baseDir."log";
$this->logfile_basename = $logname;
$this->logfile = $this->logfile_basedir.DIRECTORY_SEPARATOR.$this->logfile_basename."_".date("dmY").".log";

$this->logfile = $this->logfile_basedir.DIRECTORY_SEPARATOR.$this->logfile_basename."_".date("dmY").".log";
}

/**
Expand All @@ -86,7 +85,8 @@ public function __construct($logname, EConfigManager $cfg){
* @param ELogRow $log_row
*/
public function add(ELogRow $log_row){


$this->createLogDir();
if($log_row->type >= $this->loglevel)
error_log("(".$log_row->date.") [".self::$error_identifier[$log_row->type]."] --> ".$log_row->message."\n",3,$this->logfile);

Expand Down Expand Up @@ -123,5 +123,22 @@ public function get_log($start=0,$stop){
public function setLogDir($dir){
$this->logfile_basedir = $dir;
$this->logfile = $this->logfile_basedir.DIRECTORY_SEPARATOR.$this->logfile_basename."_".date("dmY").".log";
}
}

private function createLogDir(){
settype($this->logfile_basedir,"string");
$__mode=0777;

if(is_dir($this->logfile_basedir)) {
return;
} elseif(mkdir($this->logfile_basedir,$__mode)) {

if(is_dir($this->logfile_basedir)) {
return;
}
}

throw new LogFileNotFoundExceprions("System Error: _mkdir_(".$this->logfile_basedir.",".$__mode.").");
}

}

0 comments on commit d3bfe2c

Please sign in to comment.