Hi,
This is a very strange one but I am using the plugin Leopard Offload Media in order to offload my Wordpress Media Library files to an Amazon S3 bucket and I noticed that some files were disappearing. This happened 2 days ago and then happened again earlier today with some different files disappearing.
Upon inspecting my Amazon S3 bucket, since I have Versioning enabled, I could see the files that had been deleted and the Delete Markers with timestamps. Since the deletion had happened automatically I figured it had to be related to a Wordpress cron job. Looking at my cron jobs, there were 2 that matched up to the timing of their schedule and the deletion of the files (they were also scheduled to run every 48 hours, which explained why files were deleted 2 days ago but not yesterday.) The cron jobs in question are both related to your plugin. They are:
- wpdiscuz_gravatars_cache_delete
- wpdiscuz_delete_unattached_images
Looking at the attached images, you can see that the cron jobs were scheduled for 17 : 51 : 13 and the first file was deleted from Amazon S3 at 17 : 51 : 17, just 4 seconds later.
Have you come across anything like this before? Is there any way to resolve this aside from disabling those cron jobs? Thanks.
This happened 2 days ago and then happened again earlier today with some different files disappearing.
This doesn't have any relation to wpDiscuz for sure.
If you have any issues with the avatars, you can disable wpDiscuz Avatar Cache in wpDiscuz > Settings > General Settings admin age.
Hi Tom. I just ran the cron job manually now (specifically the wpdiscuz_delete_unnattached_images one) and it did cause the same issue - some files were deleted at that exact time. As the slug of the cron job implies, it's deleting images that are not attached to posts, but strangely only recent ones (older unattached images stay).
So I'm afraid it is the cron job that's causing the problem even though the plugin itself may not be a direct cause. I've realised that it doesn't really matter about the Amazon S3 bucket connection because if images are deleted from the Wordpress Media Library they are deleted from the S3 bucket because of the connection anyway - so the issue is simply that images are being deleted from the Wordpress Media Library when this cron job runs.
While I can understand the wpdiscuz_gravatars_cache_delete cron job having no effect, what is the purpose of the wpdiscuz_delete_unnattached_images cron job in relation to the plugin? Is is still related to avatars or ANY images?
Regardless, it is causing issues and so I've deleted the cron job for now.
The "wpdiscuz_delete_unnattached_images" deletes the images which was uploaded in comment form without submitting the comment. Sometimes people write a comment and upload an image, then decide to leave it without submitting the form. So, this kind of images become abundant and should not be kept in the server. wpDiscuz has a cron job "wpdiscuz_delete_unnattached_images" which checks these images and delete them.
We'll add an option or a hook in upcoming versions to disable this crone job.
It's a strange situation because it presumably should only find images from the comment form, but it seems to be deleting other unattached images. It could be that this is unique to my setup and combination of plugins, but I think it would be best to disable it anyway yes. Thanks for the response.
Hi everyone
I have the same issue. The cronjob deletes my whole media library.
@tomson is there a fix yet? I've temporarly set the cronjob to 2099. Hope this prevents me from repairing my library every 48 hours...
Thanks in advance!