With this change, the result of a site or network lookup by ID will be cached even if the ID does not exist. When a new site or network is created, the cache for the respective new ID is cleared.
Props mnelson4, nielsdeblaauw.
Fixes#42251.
Built from https://develop.svn.wordpress.org/trunk@45910
git-svn-id: http://core.svn.wordpress.org/trunk@45721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This tag has been used in the past, but should no longer be used. Just using the `static` keyword in code is enough for PhpDocumentor on PHP5+ to recognize static variables and methods, and PhpDocumentor will mark them as static.
Props birgire.
See #42803.
Built from https://develop.svn.wordpress.org/trunk@42746
git-svn-id: http://core.svn.wordpress.org/trunk@42576 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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
`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
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs.
See #41452.
Built from https://develop.svn.wordpress.org/trunk@41162
git-svn-id: http://core.svn.wordpress.org/trunk@41002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The behaviour was previously possible with the `blog_details` filter and `get_blog_details()` function. The former is deprecated since [38936].
This change adjusts the magic methods of `WP_Site` to also check if `$key` exists in `WP_Site::get_details()`.
Fixes#40458.
Built from https://develop.svn.wordpress.org/trunk@40478
git-svn-id: http://core.svn.wordpress.org/trunk@40354 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In previous iterations of `WP_Site`, there was concern that not all properties would be available when storing a site's details in cache. When introduced in [37918], an `ms_loaded` check was added to address this concern. Any properties that are still `false` after `ms_loaded` really are `false` and can be cached as such.
Props flixos90.
Fixes#40247.
Built from https://develop.svn.wordpress.org/trunk@40344
git-svn-id: http://core.svn.wordpress.org/trunk@40251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`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
Partial revert of [37657]. Moving existing properties in `WP_Site` from public to private broke backwards compatibility in a pretty severe way. We made an initial attempt to work around this, but due to the variety of possible issues, moving forward does not seem wise.
Fixes#36717.
Built from https://develop.svn.wordpress.org/trunk@37923
git-svn-id: http://core.svn.wordpress.org/trunk@37864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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
* Add magic `__get()`, `__set()`, and `__isset()` methods to `WP_Site` and `WP_Network.
* Provide `(int) $network->site_id` for `(string) $network->blog_id`
* Provide `(int) $site->id` for `(string) $site->blog_id`
* Provide `(int) $site->network_id` for `(string) $site->site_id`
Props flixos90, jeremyfelt.
Fixes#36717.
Built from https://develop.svn.wordpress.org/trunk@37657
git-svn-id: http://core.svn.wordpress.org/trunk@37623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Given a site ID or site object, `get_site()` retrieves site data in the same vein as `get_post()` or `get_comment()`. This will allow for clean retrieval of sites from a primed cache when `WP_Site_Query` is implemented.
Adds a `WP_Site::to_array()` method to support multiple return types within `get_site()`.
Props spacedmonkey.
See #35791.
Built from https://develop.svn.wordpress.org/trunk@37468
git-svn-id: http://core.svn.wordpress.org/trunk@37436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* A `WP_Site` object initially matches a row from `wp_blogs`.
* A site can be retrieved by its ID through `WP_Site::get_instance()`.
* Adds `sites` to the global cache group and captures instance lookups.
* The multisite bootstrap now ensures `$current_blog` is an instance of `WP_Site`.
Props johnjamesjacoby, jeremyfelt.
See #32450.
Built from https://develop.svn.wordpress.org/trunk@36393
git-svn-id: http://core.svn.wordpress.org/trunk@36360 1a063a9b-81f0-0310-95a4-ce76da25c4cd