Commit Graph

9 Commits

Author SHA1 Message Date
Aaron Jorbin 82911b1756 Cache API: introduce wp_cache_get_last_changed to improve DRY
One thing fairly common to the cache groups is a block of code to look to see when the cache was last changed, and if there isn't one, to set it for the current microtime(). It appears in 8 different places in core. This adds a new helper `wp_cache_get_last_changed` to DRY things up a bit.

Since `wp-includes/cache.php` isn't guaranteed to be loaded, this new function is in `wp-includes/functions.php`

Props spacedmonkey, desrosj.
Fixes #37464.


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


git-svn-id: http://core.svn.wordpress.org/trunk@38792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-21 02:54:34 +00:00
Gary Pendergast af69f4ab1a General: Restore usage of `$wpdb`, instead of `$this->db`.
Hiding the `$wpdb` global behind a property decreases the readability of the code, as well as causing irrelevant output when dumping an object.

Reverts [38275], [38278], [38279], [38280], [38387].
See #37699.


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


git-svn-id: http://core.svn.wordpress.org/trunk@38711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-10 06:38:31 +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 af1fb6b8d2 Query: use correct description in the docblock for `$number` in `WP_Comment_Query`, `WP_Network_Query`, and `WP_Site_Query`.
Props flixos90.
Fixes #37621.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-23 14:41:29 +00:00
Scott Taylor e7ffad7fac Query: add a `protected` field, `$db`, (composition, as it were) to `WP_*_Query` classes to hold the value for the database abstraction, instead of importing the `global $wpdb` into every method that uses it. Reduces the number of global imports by 32.
See #37699.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-18 18:21:31 +00:00
Sergey Biryukov 2443c89ee0 Docs: Clarify the `fields` argument description in `WP_Network_Query::__construct()`.
See #32504.
Built from https://develop.svn.wordpress.org/trunk@38104


git-svn-id: http://core.svn.wordpress.org/trunk@38045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-19 13:18:28 +00:00
Sergey Biryukov a7c72c31cf Multisite: Correct default value for `orderby` in `WP_Network_Query::__construct()`.
Add a unit test.

See #32504.
Built from https://develop.svn.wordpress.org/trunk@38102


git-svn-id: http://core.svn.wordpress.org/trunk@38043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-19 13:10:29 +00:00
Jeremy Felt 7b5cd0c021 Multisite: Don't store `max_num_pages` in `WP_Network_Query` query cache.
This value can be easily calculated with available data.

Props spacedmonkey.
Fixes #32504.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-07 15:52:28 +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