plugins - the content of the uploads folder gets deleted periodically, how to figure out what causes it?

admin2025-01-07  3

The entire content of my uploads folder gets deleted periodically. every few days, I'm not sure when exactly. How can I debug what causes this?

My set up is complex:

  • around 10 plugins, some custom. none of my custom plugins use wpcron or do any IO. maybe some other plugin does
  • site is multisite
  • I use the wp-json API to run some scripts including create posts and upload images
  • the files in uploads folder are random files not attached to any posts or part of the "media" database
  • the wp is run inside docker on self managed server

I've tried looking at the apache logs but there's so much stuff and I dont know the exact time in occurs.

How can I ever start figuring out what the problem is? I have no clue when it happens, or what is deleting the files. I need to start somewhere but have no clue where.

The entire content of my uploads folder gets deleted periodically. every few days, I'm not sure when exactly. How can I debug what causes this?

My set up is complex:

  • around 10 plugins, some custom. none of my custom plugins use wpcron or do any IO. maybe some other plugin does
  • site is multisite
  • I use the wp-json API to run some scripts including create posts and upload images
  • the files in uploads folder are random files not attached to any posts or part of the "media" database
  • the wp is run inside docker on self managed server

I've tried looking at the apache logs but there's so much stuff and I dont know the exact time in occurs.

How can I ever start figuring out what the problem is? I have no clue when it happens, or what is deleting the files. I need to start somewhere but have no clue where.

Share Improve this question asked May 27, 2020 at 17:38 wpuser1234wpuser1234 1 6
  • Is your uploads a volume? if not, docker will lose them on every restart. Anyway, I'm sorry that this question does not really fit this Q&A, as it is not really about WordPress (this is no default behaviour) and very specific to your case. – kero Commented May 27, 2020 at 17:48
  • the entire www folder is a bind mount so that is not the problem. And I do think it is a wordpress issue. For example maybe there is some wordpress cron I dont know about what is deleting the images, or maybe wordpress has some special log that I can use to figure out what the issue is. Something inside wordpress is deleting those images. It's not an outside process doing it, nothing else is running on the server. – wpuser1234 Commented May 27, 2020 at 17:56
  • 1 WordPress by itself (as far as I know!) does not delete anything on your filesystem, unless triggered to do so. So I assume this either has to do with your setup, theme or one of the plugins. Another possibility is that another party (hacker, someone with credentials, etc.) is doing this. – kero Commented May 27, 2020 at 18:09
  • I would switch to a default theme and disable all plugins one night to see whether that stops the problem. If so, the best thing to do would be to either dig through the code to find out what's deleting, or turn one thing on every night and see whether the problem comes back. – WebElaine Commented May 27, 2020 at 18:26
  • it seems to happen minimum 6-8 days appart so that would take way too long to troubleshoot – wpuser1234 Commented May 27, 2020 at 18:45
 |  Show 1 more comment

1 Answer 1

Reset to default 0

Did you ever find out what was causing this? I suffer from the same thing. Seems to be deleting only newly added uploads every 8 days, and for the life of me can't seem to find what is doing it. I've just now re-uploaded the exact same images, renamed their folders to the dates they belonged in, and as root set permissions really strict now, only read access from web-server. I'll see how that goes, but honestly, I thought I'd done that before already, and WP seems to delete them as user root..

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736264052a937.html

最新回复(0)