[wp-trac] [WordPress Trac] #29684: Add get_main_site_id() function
WordPress Trac
noreply at wordpress.org
Fri Sep 15 11:06:18 UTC 2017
#29684: Add get_main_site_id() function
-------------------------------------------------+------------------------
Reporter: rmccue | Owner: flixos90
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 ms-roadmap | Focuses: multisite
-------------------------------------------------+------------------------
Changes (by flixos90):
* owner: jeremyfelt => flixos90
Comment:
[attachment:29684.18.diff] is a mixture between [attachment:29684.15.diff]
and [attachment:29684.17.diff], as discussed on Tuesday. It contains
`get_main_site_id()` as a standalone function, magic getters for the
`WP_Network::$blog_id` and `WP_Network::$site_id` properties (those are
the same, except for their type), and the `get_main_site_id()` function is
used in the multisite bootstrap process to fill the `$blog_id` property if
not yet set.
The patch furthermore makes the following minor tweaks over the previous
patches:
* Ensure the property types remain backward-compatible.
`WP_Network::$blog_id` is expected to be a string, only the virtual
`WP_Network::$site_id` property must return an integer. Therefore the
helper method `WP_Network::get_main_site_id()` always returns a string.
* Add an extra test in the network tests class to ensure the `$blog_id`
property is always set correctly.
* Improve the tests in the site tests class by using existing network/site
objects created in `wpSetUpBeforeClass()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29684#comment:44>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list