aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/Log.php
diff options
context:
space:
mode:
authorGravatar Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> 2023-07-07 21:53:17 +0200
committerGravatar GitHub <noreply@github.com> 2023-07-07 21:53:17 +0200
commit7f9594b8c7d7799f2e5f89328bd5981410db8cf0 (patch)
tree67614f8f3d04e94139d19dad3dd438f3bd949368 /lib/Minz/Log.php
parent1db606bc1b6cf25d9b9c4bef362acdb964ce1e8a (diff)
fix many "Only booleans are allowed in an if condition" (#5501)
* fix many "Only booleans are allowed in an if condition" * Update cli/create-user.php Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr> * Update cli/i18n/I18nUsageValidator.php Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr> * Fix several regressions and other minor things * Fix another regression * Update lib/http-conditional.php Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr> --------- Co-authored-by: Luc <sanchezluc+freshrss@gmail.com> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'lib/Minz/Log.php')
-rw-r--r--lib/Minz/Log.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Minz/Log.php b/lib/Minz/Log.php
index 4dbdf42bc..60aba319d 100644
--- a/lib/Minz/Log.php
+++ b/lib/Minz/Log.php
@@ -81,12 +81,12 @@ class Minz_Log {
$maxSize = defined('MAX_LOG_SIZE') ? MAX_LOG_SIZE : 1048576;
if ($maxSize > 0 && @filesize($file_name) > $maxSize) {
$fp = fopen($file_name, 'c+');
- if ($fp && flock($fp, LOCK_EX)) {
- fseek($fp, -intval($maxSize / 2), SEEK_END);
+ if (is_resource($fp) && flock($fp, LOCK_EX)) {
+ fseek($fp, -(int)($maxSize / 2), SEEK_END);
$content = fread($fp, $maxSize);
rewind($fp);
ftruncate($fp, 0);
- fwrite($fp, $content ? $content : '');
+ fwrite($fp, $content ?: '');
fwrite($fp, sprintf("[%s] [notice] --- Log rotate.\n", date('r')));
fflush($fp);
flock($fp, LOCK_UN);