[wp-trac] [WordPress Trac] #27003: Introduce wp_get_network() and begin cleanup of multisite load

WordPress Trac noreply at wordpress.org
Tue Feb 4 07:02:08 UTC 2014


#27003: Introduce wp_get_network() and begin cleanup of multisite load
----------------------------+-----------------------------
 Reporter:  jeremyfelt      |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Bootstrap/Load  |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:  multisite       |
----------------------------+-----------------------------
 During the multisite load process, we use `wpmu_current_site()` to process
 the requested URL into a matching network. The access to this function is
 marked as private, and it really does perform the one task—setting the
 `$current_site` global.

 It wouldn't hurt to have a network retrieval function separate from this
 load process. Secondarily, the logic in `wpmu_current_site()` could use
 some cleanup.

 The attached patch introduces `wp_get_network()` and reduces some of the
 cruft that is in `wpmu_current_site()`.

 Some notes:
 * I dropped the `$sites = query for sites` that we use to check if only
 one network has been installed. I'm not convinced this saves any time, and
 from what I can tell we don't use the `$sites` global for anything else in
 core. This would clear out #26942
 * Unfortunately, `wp_get_network()` must remain in `ms-load.php` for now,
 as `ms-functions.php` is not available yet. Not sure if this is something
 we should think about reorganizing.
 * I have not had a chance to test this with multiple networks yet. A
 multisite, single network appears to work fine. More testing and feedback
 is very much necessary.

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


More information about the wp-trac mailing list