magento-cache-clean
magento-cache-clean copied to clipboard
Frontend Cache-Clean [F] does not seem to clear static content
When pressing F
, the files in pub/static/frontend
are still present.
Thanks for opening the issue @kolaente - I must have broken it at one point in time!
I am unable to reproduce the issue.
When I press F
the files in pub/static/frontend
are gone, only the directories remain.
My steps to reproduce on my current dev instance:
- Reload the homepage after clearing static view files.
- Then, list all files and symlinks (because I am running in deploy mode
developer
).
$ find pub/static/frontend/ -type f -or -type l
pub/static/frontend/Hyva/default/de_CH/Magewirephp_Magewire/js/livewire.js
pub/static/frontend/Hyva/default/de_CH/Magewirephp_Magewire/js/livewire.js.map
pub/static/frontend/Hyva/default/de_CH/css/styles.css
pub/static/frontend/Hyva/default/de_CH/Hyva_Theme/js/alpine.min.js
pub/static/frontend/Hyva/default/de_CH/Hyva_Theme/js/alpine.min.js.map
pub/static/frontend/Hyva/default/de_CH/Magezon_Core/css/owlcarousel/owl.carousel.min.css
pub/static/frontend/Hyva/default/de_CH/Magezon_Core/css/styles.css
pub/static/frontend/Hyva/default/de_CH/Magezon_Core/css/mgz_bootstrap.css
pub/static/frontend/Hyva/default/de_CH/Magezon_Core/css/fontawesome5.css
pub/static/frontend/Hyva/default/de_CH/Magento_Theme/favicon.ico
pub/static/frontend/Hyva/default/de_CH/images/hero-2x.jpg
pub/static/frontend/Hyva/default/de_CH/images/hyva-logo.svg
pub/static/frontend/Hyva/default/de_CH/images/logo.svg
- Press
F
in the cache-watcher - Finally, list all files and symlinks, again
$ find pub/static/frontend/ -type f -or -type
Result: no files are left.
Please let me know if I am missing a step when reproducing the issue.
I just (partially) bumped into this issue. In general, [F] clears static content files for me. However, it seems to not clear any broken symlinks. So if there is a broken symlink under pub/static
, this broken symlink will not be removed, which may lead to issues.
Use case:
- Override a file in your theme.
- Open the page, so that the symlink for this file is created.
- Remove the file from your theme, because you do not want to override it any more.
- Press [F].
Expected: The broken symlink of the old overridden file is removed. Actual: The broken symlink is not removed, so that Magento is missing a file in the frontend.
That's interesting. I wonder why the broken symlinks are not removed. If I recall correctly, this function should remove them, too...
I just bumped into this again. I have no idea about ClojureScript, but I figured the files are unlinked via the rm
function. Could it be that the following exists?
check returns false
for broken symlinks, so that they are not unlinked?
https://github.com/mage2tv/magento-cache-clean/blob/d95b541d6f7bca9098f604f1b2b951bac29954c3/src/file/system.cljs#L75