From 25e6cd45c5936cbfa487e1844a436d0b68f2bf1e Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sun, 30 Sep 2018 20:23:27 +0300 Subject: [PATCH] Fixes #16752: Fix rotating files under Windows --- framework/CHANGELOG.md | 1 + framework/log/FileTarget.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index f64282fc6c..e071a9577b 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -4,6 +4,7 @@ Yii Framework 2 Change Log 2.0.16 under development ------------------------ +- Bug #16752: Fix rotating files under Windows (samdark, nadirvishun) - Bug #16716: The ability to filter by pressing the Enter key when the option `$filterOnFocusOut` off (s1lver) - Bug #15791: Added a warning when the form names conflict (s1lver, rustamwin) - Enh #16151: `ActiveQuery::getTableNameAndAlias()` is now protected (s1lver) diff --git a/framework/log/FileTarget.php b/framework/log/FileTarget.php index 4f077e5290..ca0ecada79 100644 --- a/framework/log/FileTarget.php +++ b/framework/log/FileTarget.php @@ -115,9 +115,9 @@ class FileTarget extends Target clearstatcache(); } if ($this->enableRotation && @filesize($this->logFile) > $this->maxFileSize * 1024) { - $this->rotateFiles(); @flock($fp, LOCK_UN); @fclose($fp); + $this->rotateFiles(); $writeResult = @file_put_contents($this->logFile, $text, FILE_APPEND | LOCK_EX); if ($writeResult === false) { $error = error_get_last();