[wp-trac] [WordPress Trac] #43851: Network admin allows updating one site to have the same domain and path as another site.

WordPress Trac noreply at wordpress.org
Tue Apr 24 20:15:47 UTC 2018


#43851: Network admin allows updating one site to have the same domain and path as
another site.
---------------------------------------+-----------------------------
 Reporter:  giacocorsiglia             |      Owner:  (none)
     Type:  defect (bug)               |     Status:  new
 Priority:  normal                     |  Milestone:  Awaiting Review
Component:  Networks and Sites         |    Version:  4.9.5
 Severity:  normal                     |   Keywords:
  Focuses:  administration, multisite  |
---------------------------------------+-----------------------------
 The network admin page for updating sites in multisite (site-info.php)
 allows setting the domain and path on one site to match the domain and
 path on another site.  This creates a conflict: if multiple sites have the
 same domain or path (depending on subdomain install vs. subdirectory
 install), only one of them can actually be accessed.

 I would propose the following addition on line 82 of site-info.php:

 {{{#!php
 <?php
 // /wp-admin/network/site-info.php:82

 if ( $blog_data['domain'] !== $existing_details->domain ||
 $blog_data['path'] !== $existing_details->path ) {
     // A change to the domain or path was requested.
     if ( get_sites( [
         'domain' => $blog_data['domain'],
         'path' => $blog_data['path'],
         'site__not_in' => [ $id ], // Don't include the site we are
 changing.
         'number' => 1, // It's enough to know if one or more exist.
     ] ) ) {
         wp_die( __( 'Another site with that domain and path already
 exists.' ) );
     }
 }
 }}}

 I don't think this is the case, but if it only needs to be unique by
 network, this can be added to the query:
 {{{
 'network_id' => $existing_details->site_id,
 }}}

 If there is some reason to not make this change, then I would appreciate
 the addition of a filter either on line 82 of site-info.php or in the
 update_blog_details() function that would allow the above check to be
 added by me or other developers.  In fact, would be useful in either case!

 Thank you!

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43851>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list