From a79a4e99bcda0d6f7b367f1d7aa6f90c8f030c6e Mon Sep 17 00:00:00 2001 From: SonyPradana Date: Fri, 20 Sep 2024 23:30:54 +0700 Subject: [PATCH] fix: prevent cache `FileStorage::class` delete gitignore --- src/System/Cache/Storage/FileStorage.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/System/Cache/Storage/FileStorage.php b/src/System/Cache/Storage/FileStorage.php index 4481e836..0ece9bb8 100644 --- a/src/System/Cache/Storage/FileStorage.php +++ b/src/System/Cache/Storage/FileStorage.php @@ -103,8 +103,14 @@ public function clear(): bool ); foreach ($files as $fileinfo) { + $filePath = $fileinfo->getRealPath(); + + if (basename($filePath) === '.gitignore') { + continue; + } + $action = $fileinfo->isDir() ? 'rmdir' : 'unlink'; - $action($fileinfo->getRealPath()); + $action($filePath); } return true;