Commit Graph

12 Commits

Author SHA1 Message Date
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 1adca14cd7 Multisite: Add annotations for extended `WP_Site` properties.
Props ryanplas.
Fixes #37932.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38573 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-20 17:22:29 +00:00
John Blackbourn 94c8ca0f2e Docs: Correct various documentation around `object` and `stdClass` types.
See #37770

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


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

See #37318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:57:32 +00:00
Jeremy Felt 0358e2f4b8 Multisite: Revert property type changes in `WP_Site`.
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
2016-06-29 22:08: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
Drew Jaynes b4a1b39a95 Docs: Add changelog entries to the DocBlocks for the `$blog_id` and `$site_id` properties in `WP_Site`.
See [37657] for where access was explicitly changed from public to private.

See #36717.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-29 19:29:28 +00:00
Jeremy Felt 4cce2ca14f Multisite: Fix `switch(` spacing after [37657]
Fixes #36717.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-08 04:48:27 +00:00
Jeremy Felt b885fe6761 Multisite: Allow access to network and site properties using current naming conventions
* 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
2016-06-08 04:14:29 +00:00
Jeremy Felt 9fa38fdc31 Multisite: Introduce `get_site()`
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
2016-05-20 04:41:27 +00:00
Drew Jaynes e2cec35437 Docs: Make some minor improvements to inline docs for `WP_Site`, introduced in [36393].
* Uses third-person singular verbs in method summaries
* Adds an `@static` tag to the `WP_Site::get_instance()` DocBlock
* Adjusts return types for `WP_Site::get_instance()` to the more explicit `WP_Site|false`

See #32450. See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-07 02:13:26 +00:00
Jeremy Felt 0b69f2cd63 Multisite: Introduce the WP_Site class.
* 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
2016-01-25 21:51:26 +00:00