Opened 16 years ago
Closed 16 years ago
#12549 closed defect (bug) (fixed)
Incorrect file URL for existing uploaded images (3.0-single to multi-site)
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 3.0 | Priority: | normal |
| Severity: | blocker | Version: | 3.0 |
| Component: | Multisite | Keywords: | reporter-feedback |
| Focuses: | multisite | Cc: |
Description
I upgraded an existing 2.9.2 single WordPress install to 3.0-alpha (latest nightly build), then converted it to multi-site yesterday. Image paths on the 3.0-alpha single install were fine, but once I converted it to multi-site, the existing uploaded image paths appear to be broken.
The images for the main site (now site 1) are located in wp-content/uploads/ and broken down into year/month folders.
The existing uploaded images fail to display in the following locations in the Admin area:
- Post Thumbnail meta box: Gives me the option to remove the thumbnail, so it recognizes that an image had been assigned as the post thumbnail.
- Add Image link above the post box: Shows one image in the gallery, but the image doesn't display.
- Media Library: I'm presented with the list of existing uploaded images, but image thumbnails are missing.
I was able to get the images to display again by manually copying the year/month/ folders inside wp-content/uploads/ over to wp-content/blog.dir/1/files/.
However, the old files are still being referenced in older posts/pages, and plugins that allow image uploads (example: WP Cycle). Those will have to be fixed somehow to reflect the new image locations.
- Are there plans to include a migration script to move the existing year/month folders into the proper directory when converting from single to multi-site? If not, there should be a notice to the user during or after the conversion that they will need to manually move those folders into the correct directory.
- Existing references/links to these uploaded files will break if the user moves the files to wp-content/blog.dir/1/files/ and deletes the old folders in wp-content/uploads/. Possible to fix those references when converting from single to multi-site?
Attachments (1)
Change History (27)
#4
@
16 years ago
These changes broke the upload path on wordpress.com and could for other existing MU sites. UPLOADS and BLOGUPLOADDIR are assumed to be authoritative if they are set and should not be overridden by any value of upload_path. Perhaps the answer here is to not set UPLOADS or BLOGUPLOADDIR in ms-default-constants.php if they are not defined.
#7
@
16 years ago
- Cc jimmcq added
In the wp_upload_dir function of wp-includes/functions.php it seems like the $url variable should just be set to the value of get_option('upload_url_path').
I don't see why the next two if statements in that code attempt to override the value of $url, and ultimately had to comment them out to have the function return the expected value.
#11
follow-up:
↓ 12
@
16 years ago
- Keywords reporter-feedback added
Can some folks with custom content dirs upgraded from MU test that patch and provide feedback?
#13
@
16 years ago
I haven't tested yet, but that seems like it should do the trick. Will test this weekend.
#14
follow-up:
↓ 15
@
16 years ago
Why is it only overwrriten for the main site? Shouldn't your change also apply to all sites?
#15
in reply to:
↑ 14
@
16 years ago
Replying to jimmcq:
Why is it only overwrriten for the main site? Shouldn't your change also apply to all sites?
An upgraded MU install will have media folders as follows (excepting custom content dirs):
/wp-content/blogs.dir/1/files
/wp-content/blogs.dir/2/files
/wp-content/blogs.dir/3/files
...
A WP install after the network is enabled will have:
/wp-content/uploads
/wp-content/blogs.dir/2/files
/wp-content/blogs.dir/3/files
...
So, the only thing that needs to be excluded is a WP -> WP Network main site.
#16
follow-up:
↓ 17
@
16 years ago
I want to be able to save uploads to a completely different path... outside of wp-content and outside of the Wordpress install entirely.
I configured the upload_path and upload_url_path options, and I want Wordpress to use those options. I want $url = get_option('upload_url_path'), and I don't want the value of $url to change even though this is a multisite, and $upload_path isn't even related to WP_CONTENT_DIR or ABSPATH.
Does that make sense?
#17
in reply to:
↑ 16
@
16 years ago
Replying to jimmcq:
I want to be able to save uploads to a completely different path... outside of wp-content and outside of the Wordpress install entirely.
You can do that through a plugin and the UPLOADS & BLOGUPLOADDIR constants.
#19
@
16 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Possibly the cause of #13483
#20
@
16 years ago
- Resolution set to fixed
- Status changed from reopened to closed
Closing again. The reporter in #13483 SQL imported MU blog into a WP -> WP Network. If he had upgraded his MU install to 3.0 the blogs would be fine.
#21
@
16 years ago
Forgot to include in the above note that the blogs had a custom content set up of some kind. Importing a MU blog using the default media handling/storage won't have that problem.
#22
@
16 years ago
Here's the bit of logic that I'm not following... in function wp_upload_dir of function.php, there is a line that starts with if ( defined('UPLOADS'), but in function ms_upload_constants of ms-default-constants.php, UPLOADS get defined.
There isn't any way to un-define a constant... so why is that if ( defined('UPLOADS') check even there?
One of the early 3.0 nightly builds (before the first beta) introduced a change so that UPLOADS wasn't always defined. To me that seemed like the right thing to do, but now I find that UPLOADS is always defined no matter what again.
#23
follow-up:
↓ 25
@
16 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
QUOTE - wpmuguru — 8 weeks ago
Replying to jimmcq:
Why is it only overwrriten for the main site? Shouldn't your change also apply to all sites?
An upgraded MU install will have media folders as follows (excepting custom content dirs):
/wp-content/blogs.dir/1/files /wp-content/blogs.dir/2/files /wp-content/blogs.dir/3/files ...
A WP install after the network is enabled will have:
/wp-content/uploads /wp-content/blogs.dir/2/files /wp-content/blogs.dir/3/files ...
So, the only thing that needs to be excluded is a WP -> WP Network main site.
UNQUOTE
Just had a new site banjaxed by this uploads path issue.
Site was a WPMU 2.9.2 new build with a repository theme (modern style) being rbuilt as the home site theme. One additional blog was created for testing sub-blog to main-blog connectivity.
I upgraded to 3.0 using the automatic updater (didn't bother with any backups because this is still a very early build and I can restart from just a save of the theme folder).
Home theme is / should be blog 0 directly under blogs.dir, and the sub blog should be blog 1 in the /1/ folder according to what's said above.
Nope - there is only the folder for /1/ into which some newly uploaded images arrived using the standard post media uploader - arriving into /blogs.dir/1/uploads/2010/07/ - they should have arrived into /wp-content/uploads/2010/07/ except none of that folder path exists.
It seems that the upgrade has moved the home blog to /1/ and has overwritten the actual sub blog, even though it's still in the blogs list in admin.
The prime symptom of this is that in both admin and public of the home blog, no images of any type show in posts and pages drafts, published or whatever. The insert gallery from media uploader returns with just text links to images that do not display, and clicking those text links returns image not found. However on the server, the images are there and viewable from cPanel using the file viewer.
I've just done searches on WP.org and BP.org and there are literally hundreds of threads about non-displaying images, all started in the last few weeks.
I did have both a trac ticket and WP.org / MU and BP.org forum posts a while back reporting a fix (for image non-display) due to hosting services disabling fread (I think - might have been fopen) but all those have been removed in entirety and I cannot locate them.
I have 2 of my own sites completely killed by this, plus a client's site (upgraded from 2.9.2 single site to 3.0 single site - so it's not exclusively a multi-site issue). I will not be upgrading any more sites until this is absolutely assuredly fixed.
This issue is NOT resolved - 100's / 1000's of users have posted about this topic on WP's site forums in the last few weeks alone - it needs a major and urgent revisit.
Gaz
#24
@
16 years ago
MU 2.9.2 used blogs.dir/1/, blogs.dir/2/, etc., not wp-content/uploads/2010/. It should continue doing so in 3.0 as long as MULTISITE has not been defined. /blogs.dir/1/ is correct for a 2.9.2 to 3.0 upgrade. We'll need more information to diagnose. What do the broken image links look like? Are you defining UPLOADS, UPLOADBLOGSDIR, or BLOGUPLOADDIR, or MULTISITE in your wp-config.php?
#25
in reply to:
↑ 23
@
16 years ago
Replying to gazouteast:
QUOTE - wpmuguru — 8 weeks ago
Home theme is / should be blog 0 directly under blogs.dir, and the sub blog should be blog 1 in the /1/ folder according to what's said above.
Nope - there is only the folder for /1/ into which some newly uploaded images arrived using the standard post media uploader - arriving into /blogs.dir/1/uploads/2010/07/ - they should have arrived into /wp-content/uploads/2010/07/ except none of that folder path exists.
You misread that somewhere. There is no blog id 0. Blog ids begin at 1. Look at your wp_blogs table.
#26
@
16 years ago
- Resolution set to fixed
- Status changed from reopened to closed
Looking at this thread: http://wordpress.org/support/topic/425009 & closing this ticket.
(In [13619]) allow existing media path on main site when converting to multisite, see #12549