Commit b48e46a2 by Klimov Paul

Added error logging at `yii\caching\FileCache::gcRecursive()`

parent 67091547
...@@ -123,6 +123,7 @@ Yii Framework 2 Change Log ...@@ -123,6 +123,7 @@ Yii Framework 2 Change Log
- Enh #3380: Allow `value` in `defaultValueValidator` to be a closure (Alex-Code) - Enh #3380: Allow `value` in `defaultValueValidator` to be a closure (Alex-Code)
- Enh #3384: Added callback-style transactions (leandrogehlen, Ragazzo, samdark) - Enh #3384: Added callback-style transactions (leandrogehlen, Ragazzo, samdark)
- Enh #3399, #3241: Added support for MS SQL Server older than 2012 (fourteenmeister, samdark) - Enh #3399, #3241: Added support for MS SQL Server older than 2012 (fourteenmeister, samdark)
- Enh #3459: Added logging of errors, which may occur at `yii\caching\FileCache::gc()` (klimov-paul)
- Enh #3472: Added configurable option to encode spaces in dropDownLists and listBoxes (kartik-v) - Enh #3472: Added configurable option to encode spaces in dropDownLists and listBoxes (kartik-v)
- Enh #3518: `yii\helpers\Html::encode()` now replaces invalid code sequences with "�" (DaSourcerer) - Enh #3518: `yii\helpers\Html::encode()` now replaces invalid code sequences with "�" (DaSourcerer)
- Enh #3520: Added `unlinkAll()`-method to active record to remove all records of a model relation (NmDimas, samdark, cebe) - Enh #3520: Added `unlinkAll()`-method to active record to remove all records of a model relation (NmDimas, samdark, cebe)
......
...@@ -240,10 +240,16 @@ class FileCache extends Cache ...@@ -240,10 +240,16 @@ class FileCache extends Cache
if (is_dir($fullPath)) { if (is_dir($fullPath)) {
$this->gcRecursive($fullPath, $expiredOnly); $this->gcRecursive($fullPath, $expiredOnly);
if (!$expiredOnly) { if (!$expiredOnly) {
@rmdir($fullPath); if (!@rmdir($fullPath)) {
$error = error_get_last();
Yii::warning("Unable to remove directory '{$fullPath}': {$error['message']}", __METHOD__);
}
} }
} elseif (!$expiredOnly || $expiredOnly && @filemtime($fullPath) < time()) { } elseif (!$expiredOnly || $expiredOnly && @filemtime($fullPath) < time()) {
@unlink($fullPath); if (!@unlink($fullPath)) {
$error = error_get_last();
Yii::warning("Unable to remove file '{$fullPath}': {$error['message']}", __METHOD__);
}
} }
} }
closedir($handle); closedir($handle);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment