Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#25107 closed defect (bug) (fixed)

Deleting files from Media Library when MySQL database locked

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

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 13 years ago.
Return early if postmeta can't be deleted
25107.diff​ (539 bytes ) - added by nacin 13 years ago.

Download all attachments as: .zip

Change History (11)

#1 @jakubferenc
13 years ago

#25108 was marked as a duplicate.

#2 @jakubferenc
13 years ago

  • Resolution → invalid
  • Status new → closed

#3 @SergeyBiryukov
13 years ago

  • Description modified (diff)
  • Resolution invalid
  • Status closed → reopened

@c3mdigital
13 years ago

Return early if postmeta can't be deleted

#4 @c3mdigital
13 years ago

  • Keywords has-patch added; needs-patch removed

#5 @nacin
13 years ago

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

#6 @nacin
13 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
13 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
13 years ago

  • Milestone 3.7 → 3.8

#9 @nacin
13 years ago

  • Resolution → fixed
  • Status accepted → 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.