--- a/wp/wp-admin/network/site-info.php Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/network/site-info.php Fri Sep 05 18:40:08 2025 +0200
@@ -66,8 +66,14 @@
}
$blog_data['scheme'] = $update_parsed_url['scheme'];
+
+ // Make sure to not lose the port if it was provided.
$blog_data['domain'] = $update_parsed_url['host'];
- $blog_data['path'] = $update_parsed_url['path'];
+ if ( isset( $update_parsed_url['port'] ) ) {
+ $blog_data['domain'] .= ':' . $update_parsed_url['port'];
+ }
+
+ $blog_data['path'] = $update_parsed_url['path'];
}
$existing_details = get_site( $id );
@@ -88,17 +94,19 @@
$old_home_url = trailingslashit( esc_url( get_option( 'home' ) ) );
$old_home_parsed = parse_url( $old_home_url );
+ $old_home_host = $old_home_parsed['host'] . ( isset( $old_home_parsed['port'] ) ? ':' . $old_home_parsed['port'] : '' );
- if ( $old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) {
- $new_home_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) );
+ if ( $old_home_host === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) {
+ $new_home_url = untrailingslashit( sanitize_url( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) );
update_option( 'home', $new_home_url );
}
$old_site_url = trailingslashit( esc_url( get_option( 'siteurl' ) ) );
$old_site_parsed = parse_url( $old_site_url );
+ $old_site_host = $old_site_parsed['host'] . ( isset( $old_site_parsed['port'] ) ? ':' . $old_site_parsed['port'] : '' );
- if ( $old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) {
- $new_site_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) );
+ if ( $old_site_host === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) {
+ $new_site_url = untrailingslashit( sanitize_url( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) );
update_option( 'siteurl', $new_site_url );
}
@@ -146,8 +154,14 @@
);
if ( ! empty( $messages ) ) {
+ $notice_args = array(
+ 'type' => 'success',
+ 'dismissible' => true,
+ 'id' => 'message',
+ );
+
foreach ( $messages as $msg ) {
- echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
+ wp_admin_notice( $msg, $notice_args );
}
}
?>
@@ -194,10 +208,15 @@
<th scope="row"><?php _e( 'Attributes' ); ?></th>
<td>
<fieldset>
- <legend class="screen-reader-text"><?php _e( 'Set site attributes' ); ?></legend>
+ <legend class="screen-reader-text">
+ <?php
+ /* translators: Hidden accessibility text. */
+ _e( 'Set site attributes' );
+ ?>
+ </legend>
<?php foreach ( $attribute_fields as $field_key => $field_label ) : ?>
<label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); ?> <?php disabled( ! in_array( (int) $details->$field_key, array( 0, 1 ), true ) ); ?> />
- <?php echo $field_label; ?></label><br/>
+ <?php echo $field_label; ?></label><br />
<?php endforeach; ?>
<fieldset>
</td>