[wp-trac] [WordPress Trac] #43162: Deleting a site from a multisite network leaves orphaned database tables and files

WordPress Trac noreply at wordpress.org
Fri Jan 26 16:15:04 UTC 2018


#43162: Deleting a site from a multisite network leaves orphaned database tables
and files
--------------------------------+-----------------------------
 Reporter:  bluep92877          |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Networks and Sites  |    Version:  4.9.2
 Severity:  normal              |   Keywords:
  Focuses:  multisite           |
--------------------------------+-----------------------------
 Looking at the table structure of a typical multisite install, I see that
 tables for individual sites within the network are prefixed with
 wp_{siteid}_ tablename. When I delete a site from the from the network,
 all standard WP tables for that particular site ID are deleted; however,
 several plugin tables are not.

 As well, looking at the uploads/sites directory, the directory for that
 site (represented by its ID) is also still there along with all its files
 (media and other uploads).

 an earlier ticket:30673 suggested that this should be caught when
 uninstalling a plugin from the master site. But, I'd have to disagree.
 Most uninstall scripts use a type of {TABLEPREFIX} before its table names.
 This would delete the tables for every site in the network, wouldn't it?
 and that's not what the goal would be.

 Aside from the plugin issue are the media files that are also orphaned.
 Media file uploads is part of core, and that's not something a plugin
 author could approach.

 When deleting a site from the network, this is irrevocable. Wordpress even
 create an extra confirmation page upon delete saying so just to make sure.
 If that's the case, and this is by design, what's the point of keeping
 these extra files and tables if they are never going to be used again?

 Shouldn't all site specific db tables and all files in the uploads
 directory be deleted when a site is deleted? Or, perhaps as an
 enhancement, on the Delete Site confirmation page, could we have two
 checkboxes: "1) delete all tables associated with this site" and "2)
 delete all files associated with this site"

 Currently I have a script setup to alert me as to when a site is deleted.
 I then open up a cli to manually delete the db tables for that install,
 and then its files from the uploads directory.  This doesn't feel like the
 intended workflow to handle the orphaned elements of the site.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43162>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list