wpDiscuz - WordPress Comment Plugin
Share:
Notifications
Clear all

[Solved] WPDiscuz Cron Jobs Possibly Deleting Files From Amazon S3 Bucket


Windurin
Posts: 4
Topic starter
(@windurin)
New Member
Joined: 2 months ago

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

Amazon S3 Delete Issue 01
Amazon S3 Delete Issue 02

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.

7 Replies
Tom
Posts: 444
 Tom
Support
(@tomson)
Support Team
Joined: 6 years ago
Posted by: @windurin

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.

1 Reply
Marc
 Marc
(@marc)
Joined: 2 months ago

New Member
Posts: 1

Hey @tomson this is definitely a real issue on my site, after several days of searching for the culprit with various people a lot more knowledgeable than myself, this cron job is the reason my media library is being deleted I’ve and over 

With no way to turn it off I’ve just disabled the plugin and all add-ons, and this has worked.  My site is still in development fortunately, but it’s still really annoying and frustrating that after setting various images they all get deleted every day.

Please release the fix for this soon, it’s a real problem and needs to be turned off as it’s deleting images it has no need to go near, these are not part of the commenting system at all. In my case it’s deleting blog images, header images, images assigned to menu items, the lot. Every image is removed from the media library every day.

Looking forward to this being resolved as a priority. 

Windurin
Posts: 4
Topic starter
(@windurin)
New Member
Joined: 2 months ago

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.

Tom
Posts: 444
 Tom
Support
(@tomson)
Support Team
Joined: 6 years ago

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.

Windurin
Posts: 4
Topic starter
(@windurin)
New Member
Joined: 2 months ago

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.

hejAlina
Posts: 1
(@hejalina)
New Member
Joined: 2 months ago

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!

1 Reply
Asti
 Asti
Support
(@asti)
Joined: 4 years ago

Support member
Posts: 3567

@hejalina,

We'll add an option or a hook in upcoming versions to disable this crone job.

As Tom already mentioned, we'll add a new hook or option in the next version of the wpDiscuz plugin (no ETA). Please wait for the next update. 

Share: