переработан механизм очистки кэша
This commit is contained in:
1 parent
baa2085c97
commit
5682ef68c4
1 file changed
+4
-8
@@ -162,14 +162,10 @@
|
|||||||
*/
|
*/
|
||||||
public static function flush(): bool
|
public static function flush(): bool
|
||||||
{
|
{
|
||||||
foreach (scandir(self::$cacheDir) as $file) {
|
$di = new \RecursiveDirectoryIterator(self::$cacheDir, \FilesystemIterator::SKIP_DOTS);
|
||||||
if ($file == '.' || $file == '..')
|
$ri = new \RecursiveIteratorIterator($di, \RecursiveIteratorIterator::CHILD_FIRST);
|
||||||
continue;
|
foreach ($ri as $file) {
|
||||||
self::$quantity++;
|
$file->isDir() ? rmdir($file) : unlink($file);
|
||||||
self::$quantityWrite++;
|
|
||||||
if (!unlink(self::$cacheDir . $file)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user