Question

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?

Was it helpful?

Solution 3

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top