Ticket #30233: 30233.diff
File 30233.diff, 3.5 KB (added by , 10 years ago) |
---|
-
wp-includes/ms-deprecated.php
346 346 } 347 347 } 348 348 return esc_url_raw( $url ); 349 } 350 351 /** 352 * Check whether a blogname is already taken. 353 * 354 * Used during the new site registration process to ensure 355 * that each blogname is unique. 356 * 357 * @since MU 358 * @deprecated 4.2 359 * @deprecated Use wp_get_site() 360 * 361 * @param string $domain The domain to be checked. 362 * @param string $path The path to be checked. 363 * @param int $site_id Optional. Relevant only on multi-network installs. 364 * @return int 365 */ 366 function domain_exists($domain, $path, $site_id = 1) { 367 _deprecated_function( __FUNCTION__, '3.7', 'wp_get_site()' ); 368 369 return wp_get_site( $domain, $path, $site_id ); 349 370 } 371 No newline at end of file -
wp-includes/ms-functions.php
305 305 $path = '/'; 306 306 307 307 // Check if the domain has been used already. We should return an error message. 308 if ( domain_exists($domain, $path, $site_id) )308 if ( wp_get_site($domain, $path, $site_id) ) 309 309 return __( '<strong>ERROR</strong>: Site URL already taken.' ); 310 310 311 311 // Need to back up wpdb table names, and create a new wp_blogs entry for new blog. … … 658 658 $mydomain = "$domain"; 659 659 $path = $base.$blogname.'/'; 660 660 } 661 if ( domain_exists($mydomain, $path, $current_site->id) )661 if ( wp_get_site($mydomain, $path, $current_site->id) ) 662 662 $errors->add( 'blogname', __( 'Sorry, that site already exists!' ) ); 663 663 664 664 if ( username_exists( $blogname ) ) { … … 1126 1126 $path = '/'; 1127 1127 1128 1128 // Check if the domain has been used already. We should return an error message. 1129 if ( domain_exists($domain, $path, $site_id) )1129 if ( wp_get_site($domain, $path, $site_id) ) 1130 1130 return new WP_Error( 'blog_taken', __( 'Sorry, that site already exists!' ) ); 1131 1131 1132 1132 if ( !defined('WP_INSTALLING') ) … … 1265 1265 * Used during the new site registration process to ensure 1266 1266 * that each blogname is unique. 1267 1267 * 1268 * @since MU1268 * @since 4.2 1269 1269 * 1270 1270 * @param string $domain The domain to be checked. 1271 1271 * @param string $path The path to be checked. 1272 * @param int $site_id Optional. Relevant only on multi-network installs.1272 * @param int|array|null $site_ids Optional. Site ID(s) to search or NULL to search all. Relevant only on multi-network installs. 1273 1273 * @return int 1274 1274 */ 1275 function domain_exists($domain, $path, $site_id = 1) { 1275 function wp_get_site( $domain, $path, $site_ids = null ) { 1276 1276 1277 global $wpdb; 1277 1278 $path = trailingslashit( $path ); 1278 $result = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) ); 1279 $sql = "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s"; 1280 if ( is_array( $site_ids ) ) { 1281 $sql .= ' AND site_id IN (%s)'; 1282 } elseif ( ! empty( $site_ids ) ) { 1283 $sql .= ' AND site_id = %d'; 1284 } 1285 $result = $wpdb->get_var( $wpdb->prepare( $sql, $domain, $path, $site_ids ) ); 1279 1286 1280 1287 /** 1281 1288 * Filter whether a blogname is taken. … … 1287 1294 * @param string $path Path to be checked. 1288 1295 * @param int $site_id Site ID. Relevant only on multi-network installs. 1289 1296 */ 1290 return apply_filters( 'domain_exists', $result, $domain, $path, $site_id );1297 return apply_filters( 'domain_exists', $result, $domain, $path, $site_ids ); 1291 1298 } 1292 1299 1293 1300 /**