From 5682ef68c4f8a82b5c84bcbb30cebcb2ccd70851 Mon Sep 17 00:00:00 2001 From: rsgrinko Date: Wed, 13 Jul 2022 00:07:24 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=B0=D0=BD=20=D0=BC=D0=B5=D1=85=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B7=D0=BC=20=D0=BE=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BA=D1=8D=D1=88=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Core/Helpers/Cache.class.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/core/lib/Core/Helpers/Cache.class.php b/core/lib/Core/Helpers/Cache.class.php index 834a001..e5324d1 100644 --- a/core/lib/Core/Helpers/Cache.class.php +++ b/core/lib/Core/Helpers/Cache.class.php @@ -162,14 +162,10 @@ */ public static function flush(): bool { - foreach (scandir(self::$cacheDir) as $file) { - if ($file == '.' || $file == '..') - continue; - self::$quantity++; - self::$quantityWrite++; - if (!unlink(self::$cacheDir . $file)) { - return false; - } + $di = new \RecursiveDirectoryIterator(self::$cacheDir, \FilesystemIterator::SKIP_DOTS); + $ri = new \RecursiveIteratorIterator($di, \RecursiveIteratorIterator::CHILD_FIRST); + foreach ($ri as $file) { + $file->isDir() ? rmdir($file) : unlink($file); } return true; }