Changeset 22092 for trunk/wp-includes/ms-functions.php
- Timestamp:
- 10/01/2012 06:03:23 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/ms-functions.php
r22065 r22092 333 333 * @param string $domain 334 334 * @param string $path Optional. Not required for subdomain installations. 335 * @return int 335 * @return int 0 if no blog found, otherwise the ID of the matching blog 336 336 */ 337 337 function get_blog_id_from_url( $domain, $path = '/' ) { 338 338 global $wpdb; 339 339 340 $domain = strtolower( $ wpdb->escape( $domain ));341 $path = strtolower( $ wpdb->escape( $path ));340 $domain = strtolower( $domain ); 341 $path = strtolower( $path ); 342 342 $id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' ); 343 343 344 if ( $id == -1 ) {// blog does not exist344 if ( $id == -1 ) // blog does not exist 345 345 return 0; 346 } elseif ( $id ) { 347 return (int)$id; 348 } 349 350 $id = $wpdb->get_var( "SELECT blog_id FROM $wpdb->blogs WHERE domain = '$domain' and path = '$path' /* get_blog_id_from_url */" ); 351 352 if ( !$id ) { 346 elseif ( $id ) 347 return (int) $id; 348 349 $id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s and path = %s /* get_blog_id_from_url */", $domain, $path ) ); 350 351 if ( ! $id ) { 353 352 wp_cache_set( md5( $domain . $path ), -1, 'blog-id-cache' ); 354 return false; 355 } 353 return 0; 354 } 355 356 356 wp_cache_set( md5( $domain . $path ), $id, 'blog-id-cache' ); 357 357
Note: See TracChangeset
for help on using the changeset viewer.