Commit Graph

149 Commits

Author SHA1 Message Date
Felix Arntz
176a289050 Multisite: Introduce metadata for sites.
A new global multisite table `wp_blogmeta` is added to the database schema, and a set of `*_site_meta()` API functions are introduced.

The implementation fails gracefully when the new table is not yet available, which may happen especially shortly after the core update, before the network has been upgraded to the new database schema. The presence of the table is detected once and stored as a global setting on the main network.

Core does not yet use site metadata, but there are several use-cases to be implemented or explored in the near future, and it allows plugins to extend sites with arbitrary data, which will come in particularly handy with the upcoming REST API endpoint for sites.

Props spacedmonkey, johnjamesjacoby, jeremyfelt, flixos90.
Fixes #37923.

Built from https://develop.svn.wordpress.org/trunk@42836


git-svn-id: http://core.svn.wordpress.org/trunk@42666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-16 02:15:31 +00:00
John Blackbourn
91464bce65 Docs: Add missing code formatting to various @since entries.
See #42505

Built from https://develop.svn.wordpress.org/trunk@42678


git-svn-id: http://core.svn.wordpress.org/trunk@42506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-09 16:55:31 +00:00
Gary Pendergast
aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


Built from https://develop.svn.wordpress.org/trunk@42343


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Felix Arntz
4cb1026757 Multisite: Document all return types in get_networks().
Adds more complete documentation to get_networks() and the corresponding methods in WP_Network_Query.

Fixes #42260.

Built from https://develop.svn.wordpress.org/trunk@41918


git-svn-id: http://core.svn.wordpress.org/trunk@41752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-18 18:13:50 +00:00
Jeremy Felt
548d8c2e0d Multisite: Document all return types in get_sites().
Adds more complete documentation to `get_sites()` and the corresponding methods in `WP_Site_Query`.

Fixes #41789.

Built from https://develop.svn.wordpress.org/trunk@41912


git-svn-id: http://core.svn.wordpress.org/trunk@41746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-18 17:39:46 +00:00
Felix Arntz
3f8621b632 Multisite: Revert [41698] and [41743].
In order for `get_site_by()` to be truly beneficial, caching in `WP_Site_Query` needs to be improved to account for common use-cases and have them be invalidated less aggressively.

See #40180, #40228, #42091.

Built from https://develop.svn.wordpress.org/trunk@41884


git-svn-id: http://core.svn.wordpress.org/trunk@41718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-16 22:35:47 +00:00
Felix Arntz
18789739c1 Multisite: Revert [41719].
While `get_site_by()` makes sense as a more explicit and less complex replacement for `get_blog_details()`, it is not ready yet in terms of caching, where it currently falls short of the older function under specific circumstances.

See #40180, #40228.

Built from https://develop.svn.wordpress.org/trunk@41883


git-svn-id: http://core.svn.wordpress.org/trunk@41717 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-16 22:29:48 +00:00
John Blackbourn
b25e759621 Networks and Sites: Correct the documentation for the update_site_cache parameter of WP_Site_Query.
Props welcher, sudar
Fixes #42155

Built from https://develop.svn.wordpress.org/trunk@41795


git-svn-id: http://core.svn.wordpress.org/trunk@41629 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-09 14:26:49 +00:00
Jeremy Felt
018a94d5f5 Multisite: Use get_site_by() in get_id_from_blogname().
Fixes #42091.

Built from https://develop.svn.wordpress.org/trunk@41743


git-svn-id: http://core.svn.wordpress.org/trunk@41577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-04 18:45:52 +00:00
Felix Arntz
29e5ad5528 Multisite: Improve get_blog_details() by using get_site_by().
`get_site_by()` is now the preferred way to retrieve a site object by lookup for identifying data. By using a coherent structure and `get_sites()` internally, it has several advantages over the direct database queries and complex code in `get_blog_details()`. Therefore `get_blog_details()` is now a wrapper for `get_site_by()`, providing backward compatibility fixes where necessary.

Unit tests have been adjusted to account for the `blog-details` and `blog-lookup` cache groups, which are no longer needed.

Props spacedmonkey, jeremyfelt, flixos90.
Fixes #40228.

Built from https://develop.svn.wordpress.org/trunk@41719


git-svn-id: http://core.svn.wordpress.org/trunk@41553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-03 19:40:46 +00:00
Felix Arntz
1130241bbd Multisite: Replace calls to refresh_blog_details() with clean_blog_cache().
Fixes #42077. See #40201.

Built from https://develop.svn.wordpress.org/trunk@41717


git-svn-id: http://core.svn.wordpress.org/trunk@41551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-03 19:05:46 +00:00
Felix Arntz
a9b8f70682 Multisite: Establish clean_blog_cache() as a replacement for refresh_blog_details().
Going forward, `clean_blog_cache()` is recommended to be used instead of `refresh_blog_details()`. It has been adjusted to match the functionality of the latter, with the exception that it always requires a site ID or object to be passed. The `refresh_blog_details` action has been deprecated in favor of the `clean_site_cache` action. The function itself is not formally deprecated at this point, but will likely be in the near future.

Props spacedmonkey.
Fixes #40201.

Built from https://develop.svn.wordpress.org/trunk@41716


git-svn-id: http://core.svn.wordpress.org/trunk@41550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-03 18:41:48 +00:00
Jeremy Felt
a580793b82 Multisite: Introduce get_site_by().
`get_site_by()` is a replacement for `get_blog_details()` that uses `WP_Site_Query` to retrieve specific sites based on a given field and value.

Props flixos90, spacedmonkey.
Fixes #40180.

Built from https://develop.svn.wordpress.org/trunk@41698


git-svn-id: http://core.svn.wordpress.org/trunk@41532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-03 04:10:49 +00:00
Jeremy Felt
bdd50f28b4 Docs: Clarify docs for hooked count/date updates
See #41017.

Built from https://develop.svn.wordpress.org/trunk@41666


git-svn-id: http://core.svn.wordpress.org/trunk@41500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 03:20:47 +00:00
Jeremy Felt
78880a6a0b Multisite: Only update a site's post count when post types of post are updated.
Previously, the query to update the count of published posts would run every time any post type transitioned between a `publish`/non-published status or was deleted.

Props sboisvert, JPry, spacedmonkey.
Fixes #42021.

Built from https://develop.svn.wordpress.org/trunk@41665


git-svn-id: http://core.svn.wordpress.org/trunk@41499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 03:09:44 +00:00
Jeremy Felt
abdfe59c28 Multisite: Use get_current_blog_id() instead of $wpdb->blogid.
`get_current_blog_id()` is more appropriate for determining the ID of the current site in most cases. This eliminates the need for the global `$wpdb` in several functions and is better than the implicit global used in admin pages.

Props bnap00, spacedmonkey.
Fixes #41684.

Built from https://develop.svn.wordpress.org/trunk@41661


git-svn-id: http://core.svn.wordpress.org/trunk@41495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 01:44:47 +00:00
Felix Arntz
0892a6ebbf Multisite: Improve initializing available roles when switch sites.
Switching the available roles and the current user's capabilities no longer happens in `switch_to_blog()` and `restore_current_blog()`, instead it has been moved to a new function `wp_switch_roles_and_user()` which is hooked into the site switching process. This allows to improve performance by temporarily unhooking the function when roles and capabilities do not need to be switched.

This change ensures that switching available roles now works closer to switching user capabilities, particularly the changes in [41624]. A new `WP_Roles::for_site( $site_id )` method has been introduced, and the `WP_Roles::_init()` method has been deprecated. It is furthermore possible to retrieve the site ID for which the available roles are currently initialized through a new `WP_Roles::get_site_id()`.

Props johnjamesjacoby, flixos90.
Fixes #38645.

Built from https://develop.svn.wordpress.org/trunk@41625


git-svn-id: http://core.svn.wordpress.org/trunk@41460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-27 21:44:44 +00:00
Felix Arntz
21f18c2d30 Multisite: Initialize a user's roles correctly when setting them up for a different site.
While it has always been possible to initialize a user's roles and capabilities for another site than the current one in a multisite, the actual roles available were not switched prior to this change, possibly causing invalid roles to show up or actually valid capabilities not being available.

In order to fix this bug in a clean way, relevant parts of the `WP_User` class have been refactored. The ID of the site for which capabilities are currently initialized are now stored in a private property `WP_User::$site_id`. The `WP_User::for_blog( $blog_id )` and `WP_User::_init_caps( $cap_key )` methods have been deprecated in favor of `WP_User::for_site( $site_id )`. In addition, a new method `WP_User::get_site_id()` has been introduced to retrieve the site ID for which the user's capabilities are currently initialized.

Props ryanduff, jeremyfelt, flixos90.
Fixes #36961.

Built from https://develop.svn.wordpress.org/trunk@41624


git-svn-id: http://core.svn.wordpress.org/trunk@41459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-27 21:10:45 +00:00
Jeremy Felt
560d705b00 Multisite: Update docs for switch_to_blog().
As of [21403], autoload options are switched along with the cache key prefix.

Props stevepuddick.
Fixes #41815.

Built from https://develop.svn.wordpress.org/trunk@41373


git-svn-id: http://core.svn.wordpress.org/trunk@41206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-12 03:34:48 +00:00
Dominik Schilling
2526eb2d86 Multisite: Clarify return type of get_sites() when 'count' is passed as a query var.
Fixes #41789.
Built from https://develop.svn.wordpress.org/trunk@41331


git-svn-id: http://core.svn.wordpress.org/trunk@41162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-04 08:16:44 +00:00
Felix Arntz
473e1ba73b Multisite: Remove references to $wpdb->siteid and use get_current_network_id() instead.
Props sathyapulse, spacedmonkey.
Fixes #41507.

Built from https://develop.svn.wordpress.org/trunk@41242


git-svn-id: http://core.svn.wordpress.org/trunk@41082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-12 13:11:43 +00:00
Drew Jaynes
0401cee8b3 Docs: Reduce confusion in @since MU notationss by indicating the WP version (3.0.0) the code was merged into core while retaining the original context.
Props sathyapulse.
Fixes #41509.

Built from https://develop.svn.wordpress.org/trunk@41200


git-svn-id: http://core.svn.wordpress.org/trunk@41040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-01 20:44:43 +00:00
Jeremy Felt
3d4f2f2fea Multisite: Correct documentation for site status change hooks.
Props johnbillion.
Fixes #40287.

Built from https://develop.svn.wordpress.org/trunk@40352


git-svn-id: http://core.svn.wordpress.org/trunk@40259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-30 04:36:43 +00:00
Jeremy Felt
1c6111f3bb Multisite: Remove unused site-lookup global cache group.
The `site-lookup` group was introduced in WPMU, but never actually used in WordPress core.

Props johnjamesjacoby.
Fixes #38725.

Built from https://develop.svn.wordpress.org/trunk@40347


git-svn-id: http://core.svn.wordpress.org/trunk@40254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-28 21:08:47 +00:00
Jeremy Felt
0e7e0aa4bc Multisite: Respect $_wp_suspend_cache_invalidation when clearing network and site caches.
Props johnjamesjacoby.
Fixes #40028.

Built from https://develop.svn.wordpress.org/trunk@40346


git-svn-id: http://core.svn.wordpress.org/trunk@40253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-28 19:36:49 +00:00
Jeremy Felt
f940beae2b Multisite: Add lang_id support to WP_Site_Query.
Sites can now be queried by `lang_id`, `lang__in`, and `lang__not_in`.

Props ocean90.
Fixes #40196.

Built from https://develop.svn.wordpress.org/trunk@40340


git-svn-id: http://core.svn.wordpress.org/trunk@40247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-27 19:48:52 +00:00
Pascal Birchler
6216c997ba Multisite: After [40305], rename clean_site_details_cache() method as it's not really private.
See #40063.


Built from https://develop.svn.wordpress.org/trunk@40333


git-svn-id: http://core.svn.wordpress.org/trunk@40240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-25 15:31:43 +00:00
Felix Arntz
cde6126923 Multisite: Handle sites cache invalidation more granularly for option updates.
Previously `update_blog_option()` would trigger an invalidation of that site's entire cache although these changes did not affect the content of these caches. Furthermore changes to the special options `blogname`, `siteurl` and `post_count` should not invalidate the entire cache of that site, but only their respective site details cache. The option `home` now has the same behavior as it also belongs to the site details, but did not invalidate the cache at all previously.

Several new unit tests confirm these changes work as expected.

Fixes #40063.

Built from https://develop.svn.wordpress.org/trunk@40305


git-svn-id: http://core.svn.wordpress.org/trunk@40212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-19 16:22:45 +00:00
Gary Pendergast
e79fa03329 Roles/Capabilities: Add a new wp_roles_init filter.
Historically, it's been difficult to extend user roles, but reasonable to work around by waiting until after `init` has fired, to add custom roles and capabilities. With the addition of Locale Switching, Core now potentially loads roles before `init` has fired, leaving a window where custom roles and capabilities are not handled.

The new filter allows plugins to add their own custom roles whenever they're initialised (on page load, or when switching sites, for example), so that they can always be obeyed.

`WP_Roles` has also been tidied up a little bit, to remove duplicate code.

Props johnjamesjacoby, pento.
Fixes #23016.


Built from https://develop.svn.wordpress.org/trunk@39082


git-svn-id: http://core.svn.wordpress.org/trunk@39024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-02 00:31:32 +00:00
Jeremy Felt
555466ab82 Multisite: Replace get_blog_details() in inline documentation.
Some documentation is now out of date and some can be replaced with a mention of `get_site()`.

Fixes #37102.

Built from https://develop.svn.wordpress.org/trunk@38943


git-svn-id: http://core.svn.wordpress.org/trunk@38886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 03:39:29 +00:00
Jeremy Felt
a545afb331 Multisite: Deprecate the blog_details filter.
`get_site()` has replaced `get_blog_details()` throughout core and is the recommended way to retrieve a current or single site object.

The `blog_details` filter is applied when full details are requested from `get_blog_details()`.

To ensure backwards compatibility in the switch to `get_site()`, this `blog_details` filter is now applied in `WP_Site::get_details()` and marked as deprecated with a note to rely instead on the `site_details` filter introduced in 4.6.

Props flixos90.
See #37102.
Fixes #38491.

Built from https://develop.svn.wordpress.org/trunk@38936


git-svn-id: http://core.svn.wordpress.org/trunk@38879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 23:44:30 +00:00
Jeremy Felt
680f14fcd1 Multisite: Replace get_blog_details() in wp-includes/ms-blogs.php with get_site().
Props flixos90.
See #37102.
Fixes #38351.

Built from https://develop.svn.wordpress.org/trunk@38915


git-svn-id: http://core.svn.wordpress.org/trunk@38858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-25 18:50:30 +00:00
Jeremy Felt
1560fbcbc5 Multisite: Use get_network() and get_current_network_id() for current network data.
`get_network()` falls back to the current network when called without any arguments. Between this and `get_current_network_id()`, we can replace almost all instances of the global `$current_site` and all instances of `get_current_site()`.

This effectively deprecates `get_current_site()`, something that we'll do in a future ticket.

Props flixos90.
Fixes #37414.

Built from https://develop.svn.wordpress.org/trunk@38814


git-svn-id: http://core.svn.wordpress.org/trunk@38757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-19 04:47:30 +00:00
Jeremy Felt
b5d68be194 Multisite: Use get_sites() instead of a database lookup in get_id_from_blogname().
Because queries generated via `get_sites()` are cached, we can remove the `get_id_from_blogname` cache key.

Props flixos90.
Fixes #38175.

Built from https://develop.svn.wordpress.org/trunk@38659


git-svn-id: http://core.svn.wordpress.org/trunk@38602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-27 18:18:28 +00:00
Jeremy Felt
7fe5b6d182 Multisite: Handle get_id_from_blogname() lookups when the network domain has www..
Previously, if a network's domain started with `www.` in a subdomain configuration, a slug lookup with `get_id_from_blogname()` would not match an existing site. A similar lookup in a subdirectory configuration would work fine.

This strips `www.` from the network's domain in a subdomain configuration during the lookup and returns the site as expected.

Adds tests which would previously fail in a subdomain configuration, but now pass in both configurations.

Props igmoweb, flixos90.
Fixes #34450.

Built from https://develop.svn.wordpress.org/trunk@38658


git-svn-id: http://core.svn.wordpress.org/trunk@38601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-27 17:57:30 +00:00
Jeremy Felt
58f107fa95 Multisite: Revert [38388].
Restore `get_current_site()` to a multisite only function. Providing this in single site may be a possibility in the future, but should have a dedicated ticket and discussion.

See #37699.

Built from https://develop.svn.wordpress.org/trunk@38636


git-svn-id: http://core.svn.wordpress.org/trunk@38579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-20 21:39:29 +00:00
Sergey Biryukov
b434cda3a6 Docs: Synchronize docblocks for WP_Site_Query::__construct() and get_sites() after the changes in [37735], [38008], [38103], and [38336].
Props MaximeCulea.
Fixes #38039.
Built from https://develop.svn.wordpress.org/trunk@38596


git-svn-id: http://core.svn.wordpress.org/trunk@38539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-13 13:20:35 +00:00
Sergey Biryukov
1cdb4b52af Docs: Correct description for domain and path arguments in WP_Network_Query::__construct().
See #32504.
Built from https://develop.svn.wordpress.org/trunk@38595


git-svn-id: http://core.svn.wordpress.org/trunk@38538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-13 13:10:32 +00:00
Scott Taylor
e5225324a2 Multisite: use get_current_blog_id() where applicable, in lieu of plucking the $blog_id global from outer space.
See #37699.

Built from https://develop.svn.wordpress.org/trunk@38457


git-svn-id: http://core.svn.wordpress.org/trunk@38398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 04:55:54 +00:00
Scott Taylor
08233c6aff Multisite: move get_current_site() to load.php so that it can be used in more places, instead of importing global $current_site.
See #37699.

Built from https://develop.svn.wordpress.org/trunk@38388


git-svn-id: http://core.svn.wordpress.org/trunk@38329 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-26 21:35:30 +00:00
Jeremy Felt
eaffe99260 Multisite: Remove unnecessary reference parameters.
There is no advantage to passing parameters by reference to `get_site()`, `get_network()`, and `update_site_cache()`.

Props flixos90, ocean90 for review.
See #37615.

Built from https://develop.svn.wordpress.org/trunk@38232


git-svn-id: http://core.svn.wordpress.org/trunk@38173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-09 18:12:31 +00:00
Jeremy Felt
b45adc74df Multisite: Use get_current_blog_id() in get_site() for current site.
The global `$current_blog` is not switched in `switch_to_blog()` and can
not be used to properly retrieve current switched site information.

See #37607.

Built from https://develop.svn.wordpress.org/trunk@38217


git-svn-id: http://core.svn.wordpress.org/trunk@38158 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-08 22:33:28 +00:00
Drew Jaynes
e6267dcf19 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 2/2.

Fixes #37318.

Built from https://develop.svn.wordpress.org/trunk@38125


git-svn-id: http://core.svn.wordpress.org/trunk@38066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 19:33:30 +00:00
Drew Jaynes
e3e4762b8f Docs: Update the default value for the optional $args parameter in get_networks() following [38042].
See #32504.

Built from https://develop.svn.wordpress.org/trunk@38055


git-svn-id: http://core.svn.wordpress.org/trunk@37996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-13 16:04:29 +00:00
Jeremy Felt
f3b3ece76a Multisite: Set default $args to an empty array in get_networks().
The empty string was not incorrect. Using `array()` here instead makes things a bit more consistent by aligning with `get_sites()`, `get_users()`, and `get_terms()`.

See #32504.

Built from https://develop.svn.wordpress.org/trunk@38042


git-svn-id: http://core.svn.wordpress.org/trunk@37983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-13 05:30:29 +00:00
Sergey Biryukov
139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for _doing_it_wrong(), _deprecated_function(), _deprecated_argument(), and _deprecated_file() throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Jeremy Felt
f4d46f0235 Multisite: Revert [37874].
After [37923], `get_blog_details()` contained a now unnecessary attempt at back-compat for objects stored in cache.

See #36717.

Built from https://develop.svn.wordpress.org/trunk@37929


git-svn-id: http://core.svn.wordpress.org/trunk@37870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-30 16:40:28 +00:00
Jeremy Felt
b077123a98 Multisite: Lazy load extended WP_Site properties when requested.
In the past, `get_blog_details()` has been used to retrieve the `home`, `siteurl`, `blogname`, and `post_count` options for a site. By lazy loading properties in a `WP_Site` object, we can avoid having to use `get_blog_details()` and instead provide the properties as needed.

This introduces the global `site-details` cache group in which standard objects representing the site are stored. This will one day be a replacement for the `blog-details` cache group that is currently used in `get_blog_details()`.

This relies on the `ms_loaded` action introduced in [37916] as properties are not available via `get_option()` until multisite has been fully loaded.

Props flixos90.
Fixes #36935.

Built from https://develop.svn.wordpress.org/trunk@37918


git-svn-id: http://core.svn.wordpress.org/trunk@37859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-29 19:32:27 +00:00
Jeremy Felt
b99a31d35c Multisite: Introduce get_networks().
`get_networks()` is a wrapper for `WP_Network_Query`.

Props flixos90.
See #32504.

Built from https://develop.svn.wordpress.org/trunk@37895


git-svn-id: http://core.svn.wordpress.org/trunk@37836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-28 21:28:29 +00:00
Jeremy Felt
f111fdb69a Multisite: Introduce WP_Network_Query.
Provides a consistent way to query `$wpdb->site` for `WP_Network` objects based on domain, path, network ID, and (main) site ID.

Introduces and uses update_network_cache() and _prime_network_caches() to maintain a cached list of WP_Network objects for use in multiple queries.

Props flixos90.
See #32504.

Built from https://develop.svn.wordpress.org/trunk@37894


git-svn-id: http://core.svn.wordpress.org/trunk@37835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-28 21:27:30 +00:00