[wp-trac] [WordPress Trac] #25030: Overlapping upload paths with multiple networks

WordPress Trac noreply at wordpress.org
Thu Aug 15 02:45:53 UTC 2013


#25030: Overlapping upload paths with multiple networks
--------------------------+------------------
 Reporter:  ddean         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.7
Component:  Multisite     |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------

Comment (by nacin):

 SITE_ID_CURRENT_SITE is actually designed for the current site of that
 pageload. It, along with DOMAIN_CURRENT_SITE, PATH_CURRENT_SITE, and
 BLOG_ID_CURRENT_SITE, are used to avoid any database queries for site
 information. If you have those defined unconditionally, you actually won't
 be able to have a multi-network install. You'll see how they short-circuit
 things in wpmu_current_site(). (It's also something you can define in
 sunrise.php if you wanted to.)

 So, bigger problem. I'm actually not sure how we are to detect the main
 network. I suppose it is site_id = 1. If the site_id is not one, then we
 need to ensure that the site_id of 1 exists — and if not, we're dealing
 with the main network for whichever site_id is highest (least). So
 essentially, the main network is `SELECT id FROM $wpdb->site ORDER BY id
 LIMIT 1`. Yes, it would absolutely make sense for there to be some kind of
 constant that defines the primary network. I don't think we need to define
 it as we're nearly always going to be single-network with a site_id of 1.
 (Related: I think populate_network() needs to change to always force the
 value into site_id, as in #16568.)

 wpmu_current_site() also does something really weird. It does a SELECT *
 FROM $wpdb->site but then only cares if there is > 1 or not, in which case
 we could do a LIMIT 2. ''Or'', we could keep that query and then do things
 in PHP rather than the additional WHERE clauses we potentially use for
 $wpdb->site. Clearly, our multi-network support is weak in core.
 WordPress.org uses multiple networks but we actually define the above
 constants based on HTTP_HOST.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25030#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list