Changeset 786163
- Timestamp:
- 10/11/2013 12:13:56 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
networks-for-wordpress/trunk/networks-functions.php
r745301 r786163 319 319 } 320 320 321 $domain = untrailingslashit($domain); 321 322 $update = array('domain' => $domain); 323 322 324 if($path != '') { 325 $path = trim( $path, '/' ); 326 $path = trailingslashit( '/' . $path ); 323 327 $update['path'] = $path; 324 328 } … … 353 357 354 358 $path = (($path != '') ? $path : $site->path ); 355 $fullPath = $domain . $path;356 $oldPath = $site->domain . $site->path;359 $fullPath = untrailingslashit( $domain . $path ); 360 $oldPath = untrailingslashit( $site->domain . $site->path ); 357 361 358 362 /** also updated any associated blogs */ … … 361 365 if($blogs) { 362 366 foreach($blogs as $blog) { 363 $domain = str_replace($site->domain,$domain,$blog->domain); 364 367 $update = array(); 368 369 if($site->domain !== $domain) { 370 $update['domain'] = str_replace($site->domain,$domain,$blog->domain); 371 } 372 373 if($site->path !== $path) { 374 $search = sprintf('|^%s|', preg_quote($site->path, '|')); 375 $update['path'] = preg_replace($search, $path, $blog->path, 1); 376 } 377 378 if(empty($update)) 379 continue; 380 381 $blog_id = (int) $blog->blog_id; 382 switch_to_blog($blog_id); 383 365 384 $wpdb->update( 366 385 $wpdb->blogs, 367 array( 'domain' => $domain, 368 'path' => $path 369 ), 370 array( 'blog_id' => (int)$blog->blog_id ) 386 $update, 387 array( 'blog_id' => $blog_id ) 371 388 ); 372 373 /** fix options table values */374 $optionTable = $wpdb->get_blog_prefix( $blog->blog_id ) . 'options';375 389 376 390 foreach($url_dependent_blog_options as $option_name) { 377 391 // TODO: pop upload_url_path off list if ms_files_rewriting is disabled 378 $option_value = $wpdb->get_row("SELECT * FROM $optionTableWHERE option_name='$option_name'");392 $option_value = $wpdb->get_row("SELECT * FROM {$wpdb->options} WHERE option_name='$option_name'"); 379 393 if($option_value) { 380 394 $newValue = str_replace($oldPath,$fullPath,$option_value->option_value); 381 update_blog_option($blog->blog_id,$option_name,$newValue); 382 // $wpdb->query("UPDATE $optionTable SET option_value='$newValue' WHERE option_name='$option_name'"); 395 update_option($option_name,$newValue); 383 396 } 384 397 } 398 restore_current_blog(); 399 400 refresh_blog_details($blog_id); 385 401 } 386 402 }
Note: See TracChangeset
for help on using the changeset viewer.