[wp-trac] [WordPress Trac] #16981: Importer uploads to incorrect directory
WordPress Trac
wp-trac at lists.automattic.com
Sun Mar 27 15:37:37 UTC 2011
#16981: Importer uploads to incorrect directory
--------------------------+---------------------------
Reporter: duck_ | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: WordPress.org
Component: Import | Version:
Severity: normal | Keywords: has-patch
--------------------------+---------------------------
In some situations the importer may upload a file to a different directory
compared to the export site.
'''Steps to reproduce:'''
0. Ensure the default yyyy/mm uploads organisation setting is enabled.
1. Create a post. Set the publish date to 2005/03/xx.
2. Upload an image to the post, it will be uploaded to wp-
content/uploads/2005/03/image.jpg per media_handle_upload(), see [9663]
3. Export.
4. Import on a new site.
The image will be located in wp-content/uploads/2011/03/ (subject to
change, it will be the post_date of the attachment, i.e. date of upload).
This occurs because the attachment's post_date, which the importer relies
on to set the upload directory, may be different to the folder it is
stored in (see media_handle_upload() and [9663] again).
Proposed solution is to attempt to grab the upload location from
`_wp_attached_file` post meta and fallback to post_date which is correct
in most cases.
Do we also want to start setting the post_date of attachments to be the
same as the parent post? `'post_date' => $time` in media_handle_upload()
and friends.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16981>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list