Changeset 32760
- Timestamp:
- 06/14/2015 07:51:30 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/network/site-info.php
r32759 r32760 59 59 60 60 $blog_data = wp_unslash( $_POST['blog'] ); 61 $blog_data['scheme'] = $parsed_scheme; 61 62 62 63 if ( $is_main_site ) { … … 79 80 } else { 80 81 // Only the path can be updated for a subdirectory configuration, so capture existing domain. 81 $blog_data['scheme'] = $parsed_scheme;82 82 $blog_data['domain'] = $details->domain; 83 83 } … … 95 95 update_blog_details( $id, $blog_data ); 96 96 97 if ( isset( $_POST['update_home_url'] ) && $_POST['update_home_url'] == 'update' ) { 98 $new_details = get_blog_details( $id, false ); 99 $blog_address = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); 100 if ( get_option( 'siteurl' ) != $blog_address ) { 101 update_option( 'siteurl', $blog_address ); 102 } 103 if ( get_option( 'home' ) != $blog_address ) { 104 update_option( 'home', $blog_address ); 105 } 97 // Maybe update home and siteurl options. 98 $new_details = get_blog_details( $id, false ); 99 100 $old_home_url = trailingslashit( esc_url( get_option( 'home' ) ) ); 101 $old_home_parsed = parse_url( $old_home_url ); 102 103 if ( $old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) { 104 $new_home_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); 105 update_option( 'home', $new_home_url ); 106 } 107 108 $old_site_url = trailingslashit( esc_url( get_option( 'siteurl' ) ) ); 109 $old_site_parsed = parse_url( $old_site_url ); 110 111 if ( $old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) { 112 $new_site_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); 113 update_option( 'siteurl', $new_site_url ); 106 114 } 107 115 … … 184 192 <td> 185 193 <input name="blog[path]" type="text" id="path" value="<?php echo esc_attr( $details->path ) ?>" /><br /> 186 </td>187 </tr>188 <?php endif; ?>189 190 <?php if ( ! $is_main_site ) : ?>191 <tr class="form-field">192 <th scope="row"></th>193 <td>194 <input type="checkbox" name="update_home_url" id="update_home_url" value="update" <?php if ( get_option( 'siteurl' ) == untrailingslashit( get_blogaddress_by_id ($id ) ) || get_option( 'home' ) == untrailingslashit( get_blogaddress_by_id( $id ) ) ) echo 'checked="checked"'; ?> /> <label for="update_home_url"><?php _e( 'Update <code>siteurl</code> and <code>home</code> as well.' ); ?></label>195 194 </td> 196 195 </tr>
Note: See TracChangeset
for help on using the changeset viewer.