[wp-trac] [WordPress Trac] #30121: wpmu_delete_blog function clears the whole uploads directory

WordPress Trac noreply at wordpress.org
Sun Nov 2 22:01:45 UTC 2014


#30121: wpmu_delete_blog function clears the whole uploads directory
--------------------------------+-------------------------
 Reporter:  katazina            |       Owner:  jeremyfelt
     Type:  defect (bug)        |      Status:  assigned
 Priority:  high                |   Milestone:  4.1
Component:  Networks and Sites  |     Version:  3.5
 Severity:  critical            |  Resolution:
 Keywords:  needs-patch         |     Focuses:  multisite
--------------------------------+-------------------------

Comment (by jeremyfelt):

 Replying to [comment:5 jeremyfelt]:
 > * This can happen with or without ms-files enabled. This means we can't
 use that as a check.

 To clarify - this is most likely with `ms-files` enabled. It will also
 happen if a site's options are not available and `upload_path` returns
 empty. We can test the second scenario, I'm not sure about the first.

 > * I **think** we can be confident in the `get_blog_details()` response
 providing `$blog`

 This issue is more noticeable with `WP_DEBUG` on, as a bunch of notices
 are thrown on the second use of `wpmu_delete_blog()`. We do a sanity check
 to compare `$blog->path` and `$blog->domain` with the current network's
 data, but we don't ever check for the existence of `$blog`.

 I don't think we'll want to change anything with `wp_upload_dir()`, as it
 should fallback to a standard uploads directory for uploading files if
 nothing else can be found.

 I think we're good here if we add the check for `$blog` as a valid object
 to ensure we aren't trying to delete something that isn't there. A check
 for the existence of the `upload_path` option would also be sane, as
 `wp_upload_dir()` requires this to even have a chance at giving us the
 correct directory.

 Also - this is ~~unfortunate~~ embarassing - #26920 reported the same
 issue 9 months ago and I was unable to reproduce. I'm going to close that
 as a duplicate of this one since more progress has been made. Sorry,
 @npetetin!

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30121#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list