Repository navigation
Conversation
A cache key may begin with a period, so save() writes a hidden cache file. clean() called delete_files() without $hidden, getCacheInfo() used a helper that always skipped dot-leading names, and deleteMatching() used FNM_PERIOD. Such an entry was not listed by getCacheInfo() nor bulk-removed by clean() or deleteMatching(), so cache:clear left it in place permanently. - clean(): pass $hidden = true. .htaccess, index.* and web.config stay protected by $htdocs. - getCacheInfo(): add an optional $hidden parameter to get_dir_file_info(), keep its default behavior, and include hidden files. - deleteMatching(): drop FNM_PERIOD so wildcards match dot-leading entries, and skip the .htaccess protection file case-insensitively. The user guide and the 4.7.7 changelog describe the new behavior.
This comment has been minimized.
This comment has been minimized.
michalsn
left a comment
There was a problem hiding this comment.
I'd prefer to keep the current behavior for the reasons I mentioned in my review: #10766 (review)
Applications can already use an explicit pattern like deleteMatching('.app_*') to remove files with that prefix. In 4.7.6, we deliberately preserved the glob() behavior where deleteMatching('*') skips files whose names start with a dot.
This PR would also make cache:clear delete unrelated files such as .gitkeep and .gitignore. Adding exceptions for those two names would still leave other hidden files in the cache directory subject to deletion.
|
One concern with keeping the current behavior: without this change, cache entries whose keys start with a dot are never reported by getCacheInfo() and never removed by clean()/cache:clear or deleteMatching('*'). They can only be removed manually from the filesystem, making them effectively permanent cache entries — that is the bug this PR fixes. Regarding .gitkeep/.gitignore: those are repository scaffolding files, not cache entries. Instead of reverting the whole change, could we protect them explicitly — i.e., add them to the protected list in delete_files() (alongside .htaccess, index.* and web.config) — so repository files stay safe while hidden cache keys can still be cleared? I'm happy to adjust the PR in that direction if you prefer. |
Description
Cache entries whose keys start with a dot were skipped by
clean()/cache:clear,getCacheInfo()anddeleteMatching(), so they could never be reported or removed through the framework API. This change makes those operations hidden-aware while keeping.htaccessprotected fromdeleteMatching()and the htdocs protection files intact inclean(); regression tests and the user guide are updated. Follow-up to #10766.Checklist: