Skip to content

Commit 00e8a55

Browse files
committed
Fix cached include file count calculation
1 parent 9eab0e9 commit 00e8a55

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes for Blitz
22

3+
## 5.12.3 - Unreleased
4+
5+
- Fixed a bug in which the cached include file count was not being correctly calculated ([#833](https://github.com/putyourlightson/craft-blitz/issues/833)).
6+
37
## 5.12.2 - 2025-08-11
48

59
- Improved the handling of cacheable action requests.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "putyourlightson/craft-blitz",
33
"description": "Intelligent static page caching for creating lightning-fast sites.",
4-
"version": "5.12.2",
4+
"version": "5.12.3",
55
"type": "craft-plugin",
66
"homepage": "https://putyourlightson.com/plugins/blitz",
77
"license": "proprietary",

src/drivers/storage/FileStorage.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,13 @@ public function getCachedIncludeCount(string $path): int
324324
return 0;
325325
}
326326

327-
$path = rtrim($path, '/') . '/' . CacheRequestService::CACHED_INCLUDE_PREFIX;
328-
329327
if (!is_dir($path)) {
330328
return 0;
331329
}
332330

333-
return count(FileHelper::findFiles($path, [
334-
'only' => ['index.html'],
331+
return count(FileHelper::findDirectories($path, [
332+
'filter' => fn($path) => str_starts_with(basename($path), CacheRequestService::CACHED_INCLUDE_PREFIX),
333+
'recursive' => false,
335334
]));
336335
}
337336

0 commit comments

Comments
 (0)