mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-24 07:08:40 +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\System\File\PathException;
|
||||
use phpOMS\System\File\File;
|
||||
use phpOMS\System\File\Directory;
|
||||
use phpOMS\Validation\Validator;
|
||||
|
||||
/**
|
||||
|
|
@ -102,19 +104,12 @@ class FileLogger implements LoggerInterface
|
|||
}
|
||||
|
||||
if (is_dir($lpath) || strpos($lpath, '.') === false) {
|
||||
if (!file_exists($lpath)) {
|
||||
mkdir($lpath, 0644, true);
|
||||
}
|
||||
Directory::create($lpath, 0644);
|
||||
File::create($path = $lpath . '/' . date('Y-m-d') . '.log');
|
||||
|
||||
if (!file_exists($lpath . '/' . date('Y-m-d') . '.log')) {
|
||||
touch($lpath . '/' . date('Y-m-d') . '.log');
|
||||
}
|
||||
|
||||
$path = realpath($lpath . '/' . date('Y-m-d') . '.log');
|
||||
$path = realpath($path);
|
||||
} else {
|
||||
if (!file_exists($lpath)) {
|
||||
touch($lpath);
|
||||
}
|
||||
File::create($lpath);
|
||||
|
||||
$path = realpath($lpath);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user