Multisite: Introduce WP_Site_Query

Provides a consistent way to query `$wpdb->blogs` for `WP_Site` objects based on domain, path, site ID, network ID, and more.

Introduces and uses `update_site_cache()` and `_prime_site_caches()` to maintain a cached list of `WP_Site` objects for use in multiple queries.

Props spacedmonkey, flixos90, DrewAPicture, jeremyfelt, ocean90.
See #35791.


git-svn-id: https://develop.svn.wordpress.org/trunk@37477 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt
2016-05-20 22:03:52 +00:00
parent c7ff79df64
commit 381930974c
5 changed files with 1166 additions and 1 deletions

View File

@@ -491,7 +491,7 @@ class WP_Date_Query {
$valid_columns = array(
'post_date', 'post_date_gmt', 'post_modified',
'post_modified_gmt', 'comment_date', 'comment_date_gmt',
'user_registered',
'user_registered', 'registered', 'last_updated',
);
// Attempt to detect a table prefix.
@@ -525,6 +525,10 @@ class WP_Date_Query {
$wpdb->users => array(
'user_registered',
),
$wpdb->blogs => array(
'registered',
'last_updated',
),
);
// If it's a known column name, add the appropriate table prefix.