-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multisite support #1
Comments
This seems to be working correctly for us on a multisite. The only thing that needed to be changed was the server rewriterule in the config/htaccess. The default WP .htaccess has this: Given that is all I needed to do to fix multisite support, can we replace the fail message with an admin notice that can instead give some tips on how to set it up? |
My actual rules in a
If you have SSL enabled, you'll also need to add to your SSL section:
|
Multisite support basically comes down to three things:
The allowed path filter
class-404-template.php#L92
UBP checks to see if the requested
$path
from$_SERVER['REQUEST_URI']
contains$uploads['basedir']
withABSPATH
stripped out. So, for example, when requesting an image:/wp-content/uploads/2012/10/image.jpg
$uploads['basedir']
withoutABSPATH
on a single site is:wp-content/uploads
which exists in the requested path, so it passes.
On multisite, the requested
$path
would be:/files/2012/10/image.jpg
But
$uploads['basedir']
would be something like:/wp-content/blogs.dir/3/files/
(where "3" is a blog ID)So they don't match up. The check needs to be revised to accomidate multisite uploads directory path rewrites.
Download Path
class-404-template.php#L41
When an image is found, it's downloaded and saved to the local uploads directory. The download method, like allow_path, makes the assumption that the path to save the image to matches the path the image was requested from. In multisite, this isn't the case.
For example, single site:
image requested from:
http://site.com/wp-content/uploads/2012/10/image.jpg
image saved to:
ABSPATH.'/wp-content/uploads/2012/10/image.jpg'
But multisite:
image requested from:
http://site.com/subsite/wp-content/uploads/2012/10/image.jpg
image saved to:
ABSPATH.'/wp-content/blogs.dir/3/files/2012/10/image.jpg'
And "subsite" could also be a subdomain (subsite.site.com), or a mapped domain name. (subsite.com)
*Changes in 3.5 *
Trac ticket #19235
I haven't tested Nacin's final version of this in the 3.5 betas, but I'm pretty sure it's slated for release. Basically, in 3.5, there they'll be using wp-content/uploads/sites instead of wp-content/blogs.dir. wp_upload_dir() should account for this, but it of course needs to be tested, and the solutions for #1 and #2 need to be agnostic to whether they're running on 3.4- or 3.5+
To test any of these, you'd need to comment out the hook for requiring multisite to activate. But maybe you already did that? I was surprised to hear you activated the plugin on a multisite at all. Did it let you do it on the master site?
The text was updated successfully, but these errors were encountered: