strip www from subdomains in blog lookup, see #13104
git-svn-id: https://develop.svn.wordpress.org/trunk@14342 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
65aac68cd6
commit
eb95f8ba51
|
@ -89,7 +89,12 @@ function get_blog_details( $fields, $get_all = true ) {
|
||||||
$blog = wp_cache_get($key, 'blog-lookup');
|
$blog = wp_cache_get($key, 'blog-lookup');
|
||||||
if ( false !== $blog )
|
if ( false !== $blog )
|
||||||
return $blog;
|
return $blog;
|
||||||
|
if ( substr( $domain, 0, 4 ) == 'www.' ) {
|
||||||
|
$nowww = substr( $domain, 4 );
|
||||||
|
$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) AND path = %s ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'], $fields['path'] ) );
|
||||||
|
} else {
|
||||||
$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $fields['domain'], $fields['path'] ) );
|
$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $fields['domain'], $fields['path'] ) );
|
||||||
|
}
|
||||||
if ( $blog ) {
|
if ( $blog ) {
|
||||||
wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details');
|
wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details');
|
||||||
$blog_id = $blog->blog_id;
|
$blog_id = $blog->blog_id;
|
||||||
|
@ -101,7 +106,12 @@ function get_blog_details( $fields, $get_all = true ) {
|
||||||
$blog = wp_cache_get($key, 'blog-lookup');
|
$blog = wp_cache_get($key, 'blog-lookup');
|
||||||
if ( false !== $blog )
|
if ( false !== $blog )
|
||||||
return $blog;
|
return $blog;
|
||||||
|
if ( substr( $domain, 0, 4 ) == 'www.' ) {
|
||||||
|
$nowww = substr( $domain, 4 );
|
||||||
|
$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain IN (%s,%s) ORDER BY CHAR_LENGTH(domain) DESC", $nowww, $fields['domain'], $fields['path'] ) );
|
||||||
|
} else {
|
||||||
$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s", $fields['domain'] ) );
|
$blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s", $fields['domain'] ) );
|
||||||
|
}
|
||||||
if ( $blog ) {
|
if ( $blog ) {
|
||||||
wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details');
|
wp_cache_set($blog->blog_id . 'short', $blog, 'blog-details');
|
||||||
$blog_id = $blog->blog_id;
|
$blog_id = $blog->blog_id;
|
||||||
|
|
Loading…
Reference in New Issue