fix: deploys flush the TYPO3 caches again after PHP has picked up the release

A vhost on current/public (alvac since today) keeps running the previous
release until PHP's realpath cache expires (120 s by default); pages it
rendered after the first flush stayed in the page cache with old paths.
A second flush 150 s after the switch (also after a rollback) removes them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5.5 committed 2026-10-24 14:45:36 +02:00
1 parent 419ffe42b8
commit 4bfa0f258a
1 file changed
+15 -3
+15 -3
View File
@@ -188,11 +188,23 @@ task('deploy', [
// Caches belong to the release that goes live, so they are cleared after the symlink flip. Hooking
// into deploy:symlink rather than appending to the list above keeps them inside deploy:publish, ahead
// of deploy:unlock and deploy:success - a failing cache task must not follow a declared success.
// No OPcache reset (cachetool): its web adapter would need PHP under www.ep-reisen.de/typo3temp, which
// is the static docroot. Not needed either: the front controller stubs in the static docroots resolve
// "current" with readlink() on every request, so a new release is always loaded under new paths.
// No OPcache reset (cachetool): its web adapter would need PHP under a host's typo3temp, and the
// stubs in the static docroots resolve "current" with readlink() on every request. Vhosts that point
// at current/public pick up a new release once PHP's path cache expires: see typo3:cache:flush:delayed.
after('deploy:symlink', 'typo3:cache:flush');
// A rollback switches the code back; pages cached by the other release must not survive it
after('rollback', 'typo3:cache:flush');
// Vhosts that point at current/public (unlike the stubs) keep running the previous release for a
// while after the switch: PHP caches the resolved "current" path (realpath_cache_ttl, 120 s by
// default) and OPcache the compiled files. Pages rendered in that window land in the page cache
// after the flush above, so flush once more when it has passed.
desc('TYPO3 - Clear all caches again once PHP has picked up the switched release');
task('typo3:cache:flush:delayed', function () {
run('sleep 150');
invoke('typo3:cache:flush');
});
after('deploy:success', 'typo3:cache:flush:delayed');
after('rollback', 'typo3:cache:flush:delayed');
after('deploy:failed', 'deploy:unlock');