|
@@ -56,7 +56,6 @@ class Minz_Log {
|
|
|
|
|
|
|
|
$log = '[' . date('r') . '] [' . $level_label . '] --- ' . $information . "\n";
|
|
$log = '[' . date('r') . '] [' . $level_label . '] --- ' . $information . "\n";
|
|
|
|
|
|
|
|
- // @phpstan-ignore-next-line
|
|
|
|
|
if (defined('COPY_LOG_TO_SYSLOG') && COPY_LOG_TO_SYSLOG) {
|
|
if (defined('COPY_LOG_TO_SYSLOG') && COPY_LOG_TO_SYSLOG) {
|
|
|
syslog($level, '[' . $username . '] ' . trim($log));
|
|
syslog($level, '[' . $username . '] ' . trim($log));
|
|
|
}
|
|
}
|
|
@@ -80,7 +79,6 @@ class Minz_Log {
|
|
|
*/
|
|
*/
|
|
|
protected static function ensureMaxLogSize(string $file_name): void {
|
|
protected static function ensureMaxLogSize(string $file_name): void {
|
|
|
$maxSize = defined('MAX_LOG_SIZE') ? MAX_LOG_SIZE : 1048576;
|
|
$maxSize = defined('MAX_LOG_SIZE') ? MAX_LOG_SIZE : 1048576;
|
|
|
- // @phpstan-ignore-next-line
|
|
|
|
|
if ($maxSize > 0 && @filesize($file_name) > $maxSize) {
|
|
if ($maxSize > 0 && @filesize($file_name) > $maxSize) {
|
|
|
$fp = fopen($file_name, 'c+');
|
|
$fp = fopen($file_name, 'c+');
|
|
|
if ($fp && flock($fp, LOCK_EX)) {
|
|
if ($fp && flock($fp, LOCK_EX)) {
|
|
@@ -95,10 +93,7 @@ class Minz_Log {
|
|
|
} else {
|
|
} else {
|
|
|
throw new Minz_PermissionDeniedException($file_name, Minz_Exception::ERROR);
|
|
throw new Minz_PermissionDeniedException($file_name, Minz_Exception::ERROR);
|
|
|
}
|
|
}
|
|
|
- // @phpstan-ignore-next-line
|
|
|
|
|
- if ($fp) {
|
|
|
|
|
- fclose($fp);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ fclose($fp);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|