#29169 closed defect (bug) (fixed)
Scan for lost attachments: $lost is lost
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.0 | Priority: | normal |
| Severity: | normal | Version: | 3.1 |
| Component: | Media | Keywords: | has-patch commit |
| Focuses: | Cc: |
Description
in Media Library > Unattached > Scan for lost attachments
press the button, nothing happens.
There have been so many changes to upload.php and class-wp-media-list-table.php and now, even if the $lost query finds something, there's a redirect and $lost is null after the redirect.
Moreover, looks like there's nothing left in the code to actually display lost attachments.
I'm not sure there's still a real use case for this scan, I had to manually edit the DB to have a media file attached to a no longer existing posts since wp_delete_post() "Points all attachments to the deleted post up one level".
See #10911 for some background.
Attachments (3)
Change History (12)
#1
@
12 years ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 4.0
- Version changed from 3.9.1 to 3.1
#2
@
12 years ago
hi Sergey, thx very much.
For me, it doesn't work. It gets the query arg and that's ok but then wp_edit_attachments_query() returns 0 posts because $q['detached'] is still set.
When detached is set, wp_edit_attachments_query() sets 'post_parent' to 0 so it excludes my lost attachment which has a post_parent > 0.
If I'm not wrong, scan for lost attachment was intended for media attached to no longer existing posts but with (for any reasons) post_parent > 0 which is different from "Unattached" media that normally have post_parent = 0.
Adding to your patch unset( $q['detached'] ); together with $q['post__in'], then it works but I'm not 100% sure, there may be better ways.
#3
@
11 years ago
If I remember right "Scan for lost attachments" was added as a "way out" for users to recover gallery posts deleted before version 2.5 (or maybe earlier). If it hasn't been working for 4 years and nobody noticed, maybe it's time to retire it :)
This ticket was mentioned in IRC in #wordpress-dev by helen. View the logs.
11 years ago
#6
@
11 years ago
29169.3.patch removes the non-functional feature.

Wow. Broken 4 years ago in [15491] (see #14579). Was altered in [15642], but never fixed.
29169.patch seems to work for me.