From 0dd06a24dacd1c765bdec0fb9a449301bb7d26a8 Mon Sep 17 00:00:00 2001
From: S H Mohanjith <moha@mohanjith.net>
Date: Wed, 4 Dec 2013 21:32:11 +0200
Subject: [PATCH] What if the user got the path right but the domain wrong
---
wp-includes/ms-settings.php | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/wp-includes/ms-settings.php b/wp-includes/ms-settings.php
index f740569..81732f3 100644
a
|
b
|
if ( !isset( $current_site ) || !isset( $current_blog ) ) { |
78 | 78 | if ( $current_blog ) |
79 | 79 | wp_cache_set( 'current_blog_' . $domain . $path, $current_blog, 'site-options' ); |
80 | 80 | } |
| 81 | // One last check with current site domain and given path |
| 82 | $possible_current_blog = wp_cache_get( 'current_blog_' . $current_site->domain . $path, 'site-options' ); |
| 83 | if ( ! $possible_current_blog ) { |
| 84 | $possible_current_blog = get_blog_details( array( 'domain' => $current_site->domain, 'path' => $path ), false ); |
| 85 | if ( $possible_current_blog ) |
| 86 | wp_cache_set( 'current_blog_' . $current_site->domain . $path, $possible_current_blog, 'site-options' ); |
| 87 | } |
81 | 88 | unset($reserved_blognames); |
82 | 89 | } |
83 | 90 | |
… |
… |
if ( !isset( $current_site ) || !isset( $current_blog ) ) { |
96 | 103 | if ( ! defined( 'WP_INSTALLING' ) ) { |
97 | 104 | if ( $current_site && ! $current_blog ) { |
98 | 105 | if ( $current_site->domain != $_SERVER[ 'HTTP_HOST' ] ) { |
99 | | header( 'Location: http://' . $current_site->domain . $current_site->path ); |
| 106 | if ( isset( $possible_current_blog ) && $possible_current_blog ) { |
| 107 | header( 'Location: http://' . $possible_current_blog->domain . $possible_current_blog->path ); |
| 108 | } else { |
| 109 | header( 'Location: http://' . $current_site->domain . $current_site->path ); |
| 110 | } |
100 | 111 | exit; |
101 | 112 | } |
102 | 113 | $current_blog = get_blog_details( array( 'domain' => $current_site->domain, 'path' => $current_site->path ), false ); |