Skip to content

Commit

Permalink
fix: prevent cache FileStorage::class delete gitignore (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
SonyPradana authored Sep 20, 2024
1 parent 7562c69 commit d81efd7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/System/Cache/Storage/FileStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d81efd7

Please sign in to comment.