[wp-trac] [WordPress Trac] #30921: "Cannot Remove Old Plugin" Obliterates files!

WordPress Trac noreply at wordpress.org
Mon Jan 5 22:17:36 UTC 2015


#30921: "Cannot Remove Old Plugin" Obliterates files!
----------------------------+-----------------------------
 Reporter:  johnstonphilip  |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Filesystem API  |    Version:  4.1
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 '''The problem''': If your file permissions are 'owned' by a specific user
 (sudo chown -R www-data:username /var/www) but is thrown off somehow, you
 end up with a scenario where WP can delete files but not folders. Thus,
 when you do an auto-update, it '''HALF-DELETES''' all of the plugins you
 are updating.

 Imagine you are updating 15-20 plugins and the WP Filesystem removed the
 "parent" plugin file but no sub-directories within those plugins. The
 update can't finish and gives the error "Cannot Remove Old Plugin". Your
 WordPress becomes pretty un-usable at this point as you need to go through
 each plugin directory with a fine-toothed comb to see which plugins were
 half-deleted.

 The solution seems fairly simple: before doing an update, create an
 arbitrary folder and delete it using the WP Filesystem. If it comes back
 with errors, we know the permissions are not set right and we can stop
 trying to update.

 This way, we can prevent obliterating peoples files by half-deleting them
 - and only THEN telling them the permissions are wrong.

 '''Background:''' I recently started hosting my own WP installs on Digital
 Ocean. I am by NO means a "professional" server administrator and
 definitely have issues with permissions. However, I feel this issue is
 something that WordPress could "see coming" and at least prevent your
 entire file-system from getting utterly destroyed when doing auto-updates.

 With the popularity of Digital Ocean and self-managed systems increasing,
 I feel this issue requires immediate attention. I'm just not sure of the
 exact right place to do a check that like.

 Any thoughts?

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


More information about the wp-trac mailing list