Assets Folder - Any Recommended Processes For Managing?


I’m wondering if there are any recommended processes (built into Yii preferably) for managing and clearing the content in the assets folder. Yes I know that I can clear it anytime and it will get recreated as needed.

But what I’m asking about in particular is if there are tools out there that handle this automatically.

Reason I’m asking is that I just got a call from a client that their site wasn’t working. MySQL was displaying an out of space error. Long story short, after researching I found that there was 30GB of data in the assets folder. Cleared that out and the problem was solved.

I have no problem writing a script to clear it out say on a nightly basis but I would think that Yii would automatically handle something like this and maybe I’ve overlooked it?


if your asset folder took 30gb then you should find root cause of that problem instead of just wiping it out every day… if some assets require this amount of space then you can wipe it every hour and still hit out of disk error when those big assets are re-published…

try to investigate what takes so much space.

there is also one potential problem that could cause such disk outage: when you call "publish" without checking if passed assets path is not empty then you could get assetmanager to copy entire application dir to assets folder. doing it many times and you will end up with your app recursively copied to assets folder many times…

Yeah I know what it was. The application allows the user to upload videos which right now are stored in the protected/documents folder. So when the user needs to view one of the instructional videos I have to publish the video. Do it over and over again with 15 - 20mb mp4 files over a 3 - 4 week period and it adds up.

So yeah I see what is causing it and if it means I have to purge the assets folder every hour thats fine – I have no problem with that. I was double-checking that there wasn’t a pure “Yii” way of handling this scenario.


Why can’t you just store those files in folder that is web accessible or write action that will expose them with passthru()?

Assetmanager is rather for static web files (css, js, images) that are bundled in extension/module for simpler component sharing…