aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Kevin Papst <kpapst@gmx.net> 2017-12-09 13:52:05 +0100
committerGravatar Kevin Papst <kpapst@gmx.net> 2017-12-09 13:52:05 +0100
commit452886ea3ac4b91bc72952df659fb53ae7807c22 (patch)
treecfaf566c7546e7b2f950ab15660186b504562dd9 /lib
parent0480d4331cb3e21279220c7cd7b7486bd63d5412 (diff)
incorporated code review feedback
Diffstat (limited to 'lib')
-rw-r--r--lib/Minz/Log.php7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Minz/Log.php b/lib/Minz/Log.php
index f7029f47d..6231754fa 100644
--- a/lib/Minz/Log.php
+++ b/lib/Minz/Log.php
@@ -20,8 +20,6 @@ class Minz_Log {
const NOTICE = 8;
const DEBUG = 16;
- const MAX_LOG_SIZE = 512000; // 500kB
-
/**
* Enregistre un message dans un fichier de log spécifique
* Message non loggué si
@@ -91,8 +89,9 @@ class Minz_Log {
* @throws Minz_PermissionDeniedException
*/
protected static function checkLogfileSize($file_name) {
- if (file_exists($file_name) && filesize($file_name) > self::MAX_LOG_SIZE) {
- if (!unlink($file_name)) {
+ $maxSize = defined('MAX_LOG_SIZE') ? MAX_LOG_SIZE : 512000;
+ if (@filesize($file_name) > $maxSize) {
+ if (file_put_contents($file_name, '') === false) {
throw new Minz_PermissionDeniedException($file_name, Minz_Exception::ERROR);
}
}