Forum
Resource files aren't removed from server after deleting according assets
Hello,
Resource files aren't removed from server after deleting according assets, which results in storing unnecessary unused files.
After doing a research on the subject, I've set PERCH_UNDO_BUFFER
to 1
, as well as PERCH_CLEAN_RESOURCES
to true
in config, as an experiment. It doesn't work though, nothing happens after setting the latter.
How can I 'proactively' clean up unused resource files for a fresh start? I've read asset files may be removed after 24 hours, but I'm confused if this is the case, as well I don't want to wait each time I remove an asset, but would like the according file to be removed as well inmediately.
Thank you in advance!
Kind regards, Márton Lente
What steps are you following to delete the assets?
First I remove the image from the region, then I save it. Second I go to 'Assets' page in Perch, click on the image I've just removed from the region, then click, and confirm 'Delete'. The asset is then removed from the Assets panel (it isn't listed anymore), but the file itself still remains in the resources folder, which is basically my problem.
Of course, I can manually delete the remaining files myself, but that causes problems. E.g. when I upload an image again with the same filename, it has no preview. So I'm sure this isn't the way to do that.
In that situation you've still got the asset in your undo history. The buffer is set to
1
, so you have one level of undo. The file won't go away while it's in the history.And what happens, if I've used Perch for content editing with default
PERCH_UNDO_BUFFER
so far, but now changed it to1
(or0
)? Shall for example saving a random region multiple (more than 30) times solve my issue in theory?Does
PERCH_CLEAN_RESOURCES
have any impact on the above?I've made my suggested trial above (saving a random region multiple times just to 'stack up' history), but it didn't help. No asset file – that was earlier removed from Perch's assets – has been actually deleted from server.
PERCH_CLEAN_RESOURCES
needs to betrue
(which it is by default).Was the asset added to Perch more than 24 hours ago? The three conditions are:
PERCH_CLEAN_RESOURCES
is enabledThank you for the clear explanation!
Is there a way to set another, shorter time interval, or run the 'task' manually to avoid waiting 24 hours? Sometimes it'd be nice to have full control on clearing unused resources.
I guess I could set server time a day forward to achieve the above, but there may be more direct solution...
Thank you in advance!
Why would you need to do that? Are you running that close to your available disc space limit?
No, it's just partly because of disc space limit. It's because I use an image naming strategy e.g.
sample-image-1.jpg
,sample-image-2.jpg
etc. I want my images to be able to be downloaded with the exact filename I've named them. When I work on an image locally, resave it, then upload it again with the same file name to the server e.g.sample-image-1.jpg
, it gets renamed because of unremoved assets tosample-image-1-1.jpg
. The more I repeat this step, and especially when there is a set of images, filenames get messy.The main problem is, that 24 hours passed, but no resources has been deleted despite of my trials. Is there a chance that it's because of some wrong server settings? I'm on Windows, XAMPP. Here is my extended Perch information:
Thank you in advance!
Have you re-saved your content to trigger the cleanup?
Yes I have, the according region and others too, several – obviously more than 30 – times during my trials.
I don't know then. If there's any doubt whether a file is safe to delete or not, Perch doesn't delete it. Things should eventually just wash out with the majority of unused files eventually being removed.
It sounds like you have requirements of wanting to use software to manage your assets, but also manage the filenames yourself. For most CMSs those requirements will conflict, as the system needs to implement revision control as well as making sure that multiple users don't overwrite each others files, and that caches are busted when a new version of a file is uploaded.
I don't have a solution for your requirements - it's not a problem we're trying to solve with Perch.
Thank you for your help, no problem. My issue is basically that my unused resources aren't deleted automatically, though – based on the docs – they should. It has nothing to do with the naming of files – I just provided that for understanding the context.
I'll run some tests on my production server too – I'll share here if I find what the problem was.
Have a nice day!
Hello,
Though I couldn't force automatic cleanup of resources, I found a manual way I was looking for, that solved my issue for extreme resources-control, that I share below:
resources
folder.perch3_resources
table e.g. in phpMyAdmin, and delete the according row(s) too.resources
folder, and can issue a 'fresh start'.I've tested this, and it works for my case.