mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-13 23:28:39 +00:00
Pull out file/directory creation with exceptions
This commit is contained in:
parent
6b84376742
commit
5311b12bfb
|
|
@ -17,6 +17,8 @@ namespace phpOMS\Log;
|
||||||
|
|
||||||
use phpOMS\Datatypes\Exception\InvalidEnumValue;
|
use phpOMS\Datatypes\Exception\InvalidEnumValue;
|
||||||
use phpOMS\System\File\PathException;
|
use phpOMS\System\File\PathException;
|
||||||
|
use phpOMS\System\File\File;
|
||||||
|
use phpOMS\System\File\Directory;
|
||||||
use phpOMS\Validation\Validator;
|
use phpOMS\Validation\Validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -102,19 +104,12 @@ class FileLogger implements LoggerInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_dir($lpath) || strpos($lpath, '.') === false) {
|
if (is_dir($lpath) || strpos($lpath, '.') === false) {
|
||||||
if (!file_exists($lpath)) {
|
Directory::create($lpath, 0644);
|
||||||
mkdir($lpath, 0644, true);
|
File::create($path = $lpath . '/' . date('Y-m-d') . '.log');
|
||||||
}
|
|
||||||
|
|
||||||
if (!file_exists($lpath . '/' . date('Y-m-d') . '.log')) {
|
$path = realpath($path);
|
||||||
touch($lpath . '/' . date('Y-m-d') . '.log');
|
|
||||||
}
|
|
||||||
|
|
||||||
$path = realpath($lpath . '/' . date('Y-m-d') . '.log');
|
|
||||||
} else {
|
} else {
|
||||||
if (!file_exists($lpath)) {
|
File::create($lpath);
|
||||||
touch($lpath);
|
|
||||||
}
|
|
||||||
|
|
||||||
$path = realpath($lpath);
|
$path = realpath($lpath);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user