[wp-trac] [WordPress Trac] #29684: Add get_main_site_id() function
WordPress Trac
noreply at wordpress.org
Fri Jul 28 12:26:56 UTC 2017
#29684: Add get_main_site_id() function
--------------------------------------+-------------------------
Reporter: rmccue | Owner: jeremyfelt
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 4.9
Component: Networks and Sites | Version: 3.9
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: multisite
--------------------------------------+-------------------------
Comment (by flixos90):
Replying to [comment:19 spacedmonkey]:
> 1. To cache the result. The main site will likely never change. Because
of this fact, it should be stored. This saves doing any queries on the
blogs table. Take for example a network with 25k sites and 57 networks and
no object cache enabled. That get_sites lookup could be expensive. Calling
from a network option is a much faster lookup.
Right, that's a good point. With the latest patch
[attachment:29684.5.diff] the lookup is only cached for sites with an
external object cache. A network option would indeed improve this.
> 3. Storing it in the network option makes the lookup much easier. How
easy is it to find list of a main sites?
I don't necessarily think using a network option makes it easier than
simply using `get_main_site_id()`.
> I am not sure I understand your point about `populate_network`. I added
the network option in there and seems like network id and site id (blog
id) are available at the point, what is the issuing in saving it?
Please review your latest patch [attachment:29684.4.diff]: It only sets
the `main_site` for the ''initial'' network that is set up. The network
option is ''not'' set for any further network (like any other network when
using multi-network). It actually does not work through that function
since it is unaware of the matching site ID (except for when setting up
multisite, where it's always 1).
Summarizing, I'm not convinced we need a network option. I'm also not
heavily against it though. Let's wait for further opinions.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29684#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list