WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#11455 closed defect (bug) (fixed)

Bulk "Delete Permanently" moves attachments to trash

Reported by: scribu Owned by: nacin
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9
Component: Media Keywords: has-patch
Focuses: Cc:

Description

On the Media editing screen, choosing "Delete Permanently" moves selected attachments to the trash, instead of deleting them.

Attachments (3)

11455-wp_delete_attachment.diff (472 bytes) - added by nacin 4 years ago.
11455-wp_delete_attachment.2.diff (473 bytes) - added by nacin 4 years ago.
Typo in patch.
11455-wp_delete_attachment.3.diff (1.3 KB) - added by nacin 4 years ago.
Also adds MEDIA_TRASH check to wp_trash_post.

Download all attachments as: .zip

Change History (20)

comment:1 follow-up: PeteMall4 years ago

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

I wasn't able to replicated this. Trash for Media was removed from 2.9 and the "Delete Permanently" action deletes the attachments on my local trunk install.

comment:2 nacin4 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

I can reproduce. Looking into it.

comment:3 in reply to: ↑ 1 nacin4 years ago

  • Keywords has-patch added

We need to add checks for EMPTY_TRASH_DAYS and MEDIA_TRASH.

comment:4 ryan4 years ago

Shouldn't that still check for !$force_delete rather than $force_delete?

nacin4 years ago

Typo in patch.

comment:5 nacin4 years ago

Yep, already repatched.

comment:6 automattor4 years ago

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

(In [12415]) Delete instead of trash when bulk deleting media. Props nacin. fixes #11455

comment:7 ryan4 years ago

We might also want to check MEDIA_TRASH in wp_trash_post() if the type is attachment. This seems good enough for now though.

nacin4 years ago

Also adds MEDIA_TRASH check to wp_trash_post.

comment:8 follow-up: nacin4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Patch to add MEDIA_TRASH check to wp_trash_post.

Random thought -- we should add wp_trash_attachment() to 3.0.

comment:9 in reply to: ↑ 8 azaozz4 years ago

  • Milestone changed from 2.9 to 3.0

Replying to nacin:

Random thought -- we should add wp_trash_attachment() to 3.0.

Yes, don't really like how wp_trash_post() calls wp_delete_attachment() and wp_delete_attachment() calls back wp_trash_post() in the above patch...

comment:10 hakre4 years ago

Aren't this two tickets? The one is fixed and the additional stuff still opened?

comment:11 follow-up: hakre4 years ago

nacin, I'll close the ticket for now because I hope that will catch your attention. Shouldn't we move the "unfixed"/new part into it's own ticket? (see my last comment)

comment:12 hakre4 years ago

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

comment:13 dd324 years ago

I'll close the ticket for now because I hope that will catch your attention

Please dont close tickets in order to get someones attention..

comment:14 in reply to: ↑ 11 nacin4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Replying to hakre:

nacin, I'll close the ticket for now because I hope that will catch your attention. Shouldn't we move the "unfixed"/new part into it's own ticket? (see my last comment)

There isn't harm in keeping them as one ticket. There was one part we needed to commit late in 2.9. The rest is directly linked to this but didn't need to go into 2.9, so a core dev moved the milestone to 3.0.

I would consider spinning off the last patch here to a new ticket that also includes wp_trash_attachment(), but wp_trash_attachment() will be addressed after the resolutions of #11470 and #11394, and trash for media.

comment:15 nacin4 years ago

  • Owner set to nacin
  • Status changed from reopened to accepted

comment:16 nacin4 years ago

  • Milestone changed from 3.0 to 3.1

We never got to trash for media in 3.0.

comment:17 nacin4 years ago

  • Milestone changed from Awaiting Triage to 3.0
  • Resolution set to fixed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.