Repository navigation
feat(purge): purge page caches on deploy by a per-site mode - #13
Merged
Merged
Conversation
purge.php adds cache:purge, run as purge says: soft (default), hard, auto (hard when the built assets changed, otherwise nothing) or none. A site sets its own default; a deploy overrides it with -o purge=hard. It also adds cache:clear:wp:objectcache:only, since wp cache flush makes kinsta-mu-plugins purge the whole Kinsta page cache, and cache:clear:cachetags, which passes --hard for a hard purge. The recipe is opt-in, so sites that don't import it are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every deploy empties the page caches, often twice.
cache:clear:wp:objectcacherunswp cache flush, which kinsta-mu-plugins hooks to purge the whole Kinsta page cache, and most sites also runcache:clear:kinsta. solarplexius and mutti each worked around this in their owndeploy.php(https://github.com/generoi/solarplexius/pull/259, https://github.com/generoi/mutti/pull/242). This moves that here and makes the purge a setting.purge.php(opt-in, so sites that don't import it are unchanged) addscache:purge, which runs the site'spurge_tasksaspurgesays:purgesoft(default)hardwp cachetags flush --hard.autohardwhen the built assets changed, otherwise nothing.noneA site sets its default with
set('purge', 'auto'); a deploy overrides it with-o purge=hard, which the deploy workflow's newpurgeinput passes (generoi/github-actions#85).cache:check_assetsruns beforedeploy:symlinkand compares a checksum of the files underassets_dirs(default{{theme_dir}}/build) in the live and new release. It hashes the whole directory, so Mix'spublic/, wp-scripts'build/anddist/all work. If a directory isn't in the release, it warns and purges, so a wrong path can't silently stop purges. Rollbacks don't run it, so underautothey always purge. It also rejects an invalidpurgebefore the release goes live.cache:clear:wp:objectcache:onlyflushes the object cache withwp eval "wp_cache_flush();", which Kinsta doesn't hook.cache:clear:cachetagsadds--hardfor a hard purge (feat: flush --hard purges with soft invalidators too sage-cachetags#72).cache:clear:wp:objectcacheitself is unchanged, because Panini relies on its implicit Kinsta purge and has nocache:clear:kinsta.Tested with Deployer 7 on a local host:
autowith changed assets runs hard;-o purge=softoverrides a site'sauto;The checksum pipeline was run in a Linux container for these cases:
current→ differ, exit 0.Not yet run in a real deploy; solarplexius and mutti are the pilots.
🤖 Generated with Claude Code