Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#25107 closed defect (bug) (fixed)

Deleting files from Media Library when MySQL database locked

Reported by: jakubferenc's profile jakubferenc Owned by: nacin's profile nacin
Milestone: 3.8 Priority: normal
Severity: major Version: 3.6
Component: Media Keywords: has-patch commit
Focuses: Cc:

Description (last modified by SergeyBiryukov)

While permamently deleting files uploaded to a post, I incidentally had set in the mysql config "innodb_force_recovery = 1" and therefore, as it is my understanding, the database was protected against any changes.

Files were, however, permamently deleted from the filesystem but kept in the databased and show in the media library, naturally without the associated image files.

Attachments (2)

25107.patch (573 bytes) - added by c3mdigital 12 years ago.
Return early if postmeta can't be deleted
25107.diff (539 bytes) - added by nacin 12 years ago.

Download all attachments as: .zip

Change History (11)

#1 @jakubferenc
12 years ago

#25108 was marked as a duplicate.

#2 @jakubferenc
12 years ago

  • Resolution set to invalid
  • Status changed from new to closed

#3 @SergeyBiryukov
12 years ago

  • Description modified (diff)
  • Resolution invalid deleted
  • Status changed from closed to reopened

@c3mdigital
12 years ago

Return early if postmeta can't be deleted

#4 @c3mdigital
12 years ago

  • Keywords has-patch added; needs-patch removed

#5 @nacin
12 years ago

  • Milestone changed from Awaiting Review to 3.7
  • Owner set to nacin
  • Status changed from reopened to accepted

@nacin
12 years ago

#6 @nacin
12 years ago

  • Keywords commit added

We're ultimately not doing everything inside of an atomic transaction. So I think I prefer something like 25107.diff that specifically waits to see if the primary delete query is successful.

#7 @ocean90
12 years ago

An issue with 25107.diff could be, that deleting metadata works, but the primary delete query fails. This results in a post without any meta, like for image sizes, which means, that image_get_intermediate_size() will fail and the image files can't be deleted.

#8 @nacin
12 years ago

  • Milestone changed from 3.7 to 3.8

#9 @nacin
12 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 26543:

Return false from wp_delete_post() and wp_delete_attachment() if the DELETE is unsuccessful.

This prevents attachments from being deleted off disk when a DB is locked and the delete is otherwise unsuccessful.

fixes #25107.

Note: See TracTickets for help on using tickets.