Project

General

Profile

Actions

Bug #5964

closed

Plugins should not create upload directories until they're needed

Added by Boone Gorges almost 8 years ago. Updated over 6 years ago.

Status:
Resolved
Priority name:
Normal
Assignee:
Daniel Jones
Category name:
WordPress (misc)
Target version:
Start date:
2016-08-29
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

I got a notification from Lihua that the Commons has a large number of empty directories. The vast majority appear to be linked to user uploads: the object in question (group, user, etc) has an upload directory created, without anything to put into it. I'm guessing that, at least in some of these cases, the directory is being created at the same time as the object (eg, group). I don't think this is necessary; we should just create the directory when it's first needed to hold an upload. We could also have a cleanup routine that empties a directory after a file deletion makes it empty.

Here are the directory types I see in Lihua's log file:
1. /bp-group-documents/1234
2. /www/wp-content/blogs.dir/1/files/avatars/1234
3. /www/wp-content/blogs.dir/1/files/group-documents/1234
4. /wp-content/uploads/bp-attachments/1234
5. /www/wp-content/blogs.dir/999/files/2012/06

1 and 3 are both tied to buddypress-group-documents. We run a fork of this plugin, so let's fix the problem there. 4 and possibly 2 are linked to BuddyPress, so we should do a check to make sure we're not missing anything obvious there. 5 (which forms the vast majority of instances) is due to WP itself. I don't want us to bend over backward to fix this, but it would be nice to understand the logic that WP is using and to see if there's any obvious improvements to be made.

Dan, can you have a first pass at this? The first step will be to understand how and when the directories are being created. Then we can decide what, if anything, to do about it.


Files

Actions

Also available in: Atom PDF