Skip to content

[6.x] Skip a Stache file that is removed while it is being read - #15903

Open
joshdaugherty wants to merge 1 commit into
statamic:6.xfrom
joshdaugherty:fix-stache-vanished-files
Open

joshdaugherty wants to merge 1 commit into
statamic:6.xfrom
joshdaugherty:fix-stache-vanished-files

Conversation

@joshdaugherty

Copy link
Copy Markdown
Contributor

Skips a Stache file that is removed while it is being traversed or read, instead of aborting the traversal or rebuilding the file as a new, empty item.

  • Traverser::traverse(): if getMTime() throws, skip the file only when a fresh scandir() shows it is gone; otherwise rethrow.
  • Store::paths(), Store::getItemFromModifiedPath(), BasicStore::getItem() and TaxonomyTermsStore (paths(), getItem(), getItemFromModifiedPath()): when File::get() returns null and a fresh listing confirms the file is gone, treat it as gone.

Tests: a file removed between listing and stat is skipped by the traverser; paths() skips a path that no longer exists; getItem() returns null for a file removed after its path was recorded. Each fails on 6.x without the change. The taxonomy term variants share the same guard and have no separate test.

Fixes #15902

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A Stache file deleted while it is being traversed or read aborts the traversal or is rebuilt as an empty item

1 participant