127 | | // @todo we should be able to cache the blog ID of a network's main site easily. |
128 | | $current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", |
129 | | $current_site->domain, $current_site->path ) ); |
| 127 | if ( ! $current_site->blog_id = wp_cache_get( 'network_' . $current_site->id . '_blog_id', 'site-options' ) ) { |
| 128 | $current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", |
| 129 | $current_site->domain, $current_site->path ) ); |
| 130 | wp_cache_add( 'network_' . $current_site->id . '_blog_id', $current_site->blog_id, 'site-options' ); |
| 131 | } |