I ran this script via php -f cache.php destroy
and now it appears as though all site CSS is gone when it is loaded. How could clearing the cache of Magento remove CSS entirely and what would you do to get it back?
-
1I think more people would be able to help if you provide a little more detail of the problem? What do the CSS links on your page look like? (if they're there at all). When you click on the link to a css file what sort of page do you see? An empty page? A 404? Something else? Your problem description is a little vague and unlikely to be answered as is.– Alana StormCommented Apr 11, 2013 at 20:31
3 Answers
Firstly, don't just blindly add code or install modules without actually looking at what they do first. For all you know - it could well be a trojan.
--
If you look at the source of the class you are executing, you can see that the destroy
parameter calls this method
public function cleanMedia()
Which empties the CSS and JS cache.
At a guess, it sounds like the class is removing the combined CSS/JS files - but the Magento block cache isn't being cleared properly - and that it is still referencing the 'old' combined CSS file (you could check this by looking at the CSS filename in the source before and after).
I'd imagine that flushing the block cache would solve the issue.
Remember, if you are using a single-level cache, then it won't be aware of tags. So you won't be able to selectively purge caches - short of emptying the log.
It could be that the new cache is referring to a old CSS compressed version. What you should try is clear the CSS and Js cache from the backend and then run
rm -R /absolute/path/to/shop/var/cache/*
This will clean the cache instantly (well almost). I think that might help
-
Thanks for the input here!!! I ended up resolving it via the method noted in my answer. Even though your answer didn't do the trick, it did remind me to check some other issues re: file permissions that were enlightening and need to be addressed (even though they did not relate to this problem). :) Commented Apr 12, 2013 at 6:05
-
1That would obliterate the entire site cache for the sake of a single CSS change? On a production store - this would cripple performance. Emptying the entire cache so aggressively should never be done. Commented May 12, 2013 at 22:55
It turns out that after a cache clear, if js and css combination are turned on, it can cause this problem. The resolution was to enter the database and go into the core_config_data
table, search for the merge config options and flip them from 1
to 0
. Kind of convoluted, but it worked. Simply changing them from active to inactive via xml did not do the trick. Unfortunately doing this via the database was seemingly the only option as the admin control panel was so highly effected that even submits were not working properly when trying to make changes with the css being stripped out.
-
but turning it off doesn't really solve the issue, just hide it right? Not being able to submit data in the backend is due to the fact that all forms in Magento use javascript to submit. Commented Apr 12, 2013 at 6:52
-
No, it actually did resolve the issue entirely. I can turn it back on and it works now. It has to be toggled on and off in this case. Odd, but this does the job. Commented Apr 12, 2013 at 8:22
-
1The Magento Javascript and CSS merge function has always been more or less a beta type thing. I went with the Fooman Speedster module for this function as it was more stable through manual cache clearing. Commented May 12, 2013 at 17:09