Commit Graph

21 Commits

Author SHA1 Message Date
Sergey Biryukov
29b072e706 Docs: Add missing description for $wpdb, $wp_db_version, and $wp_current_db_version globals.
Props mukesh27, utsav72640, immeet94, SergeyBiryukov.
See #45604.
Built from https://develop.svn.wordpress.org/trunk@45734


git-svn-id: http://core.svn.wordpress.org/trunk@45545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:12:56 +00:00
Gary Pendergast
4803fc405e Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in wp-includes.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-02 23:42:58 +00:00
Adam Silverstein
cd67264bb2 Multisite: add new sites_pre_query and networks_pre_query filters to short circuit WP_Site_Query and WP_Network_Query queries.
Similar to the `posts_pre_query` filter for WP_Query added in #36687. These filters lets you short circuit the queries to return your own results.

Add a new filter `sites_pre_query` - which returns null by default. Return a non-null value to bypass WordPress's default `get_sites` queries.

Developers should note that filtering functions that require pagination information are encouraged to set the `found_sites` property of the `WP_Site_Query` object, passed to the filter by reference. If `WP_Site_Query` does not perform a database query, it will not have enough information to generate these values itself.

Add a new filter `networks_pre_query` - which returns null by default. Return a non-null value to bypass WordPress's default `get_networks` queries.

Developers should note that filtering functions that require pagination information are encouraged to set the `found_networks` property of the `WP_Network_Query` object, passed to the filter by reference. If `WP_Network_Query` does not perform a database query, it will not have enough information to generate these values itself.

Props spacedmonkey.
Fixes #45749.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 17:26:51 +00:00
desrosj
268402cf53 PHP7.3 compatibility: Fix compact throwing notices.
In PHP 7.3, the `compact()` function has been changed to issue an `E_NOTICE` level error if a passed string refers to an unset variable. In previous versions of PHP, this notice was silently skipped. The full RFC can be viewed here: https://wiki.php.net/rfc/compact.

Props jorbin, desrosj.

Merges [43819] and [43832] to trunk.

Fixes #44416.
Built from https://develop.svn.wordpress.org/trunk@44166


git-svn-id: http://core.svn.wordpress.org/trunk@43996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 05:13:52 +00:00
John Blackbourn
2361ca884f Docs: Document more parameters and properties using typed array notation.
See #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@42706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-25 19:33: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
John Blackbourn
9fdbe6538e Docs: Remove & prefixes from parameter documentation to avoid doc parsing errors.
Props sudar for the original patch.

See #35974

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


git-svn-id: http://core.svn.wordpress.org/trunk@41520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 22:03:33 +00:00
John Blackbourn
d510413811 Docs: Fix various filter documentation.
See #38462, #41017

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


git-svn-id: http://core.svn.wordpress.org/trunk@41055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-03 14:34:44 +00:00
Drew Jaynes
0860bb2771 Docs: Remove @access notations from method DocBlocks in wp-includes/* classes.
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
2017-07-27 00:41:44 +00:00
Felix Arntz
d4607c17b7 Multisite: Improve caching in WP_Network_Query by ignoring the $fields argument.
Prior to this change there were two different cache keys used for the same query. That is because regardless of the `$fields` argument, the query response will be the same. This was already fixed for `WP_Site_Query` in [41059].

Props spacedmonkey.
Fixes #41347.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-17 20:16:47 +00:00
Sergey Biryukov
30bad141ad Docs: Add a @global entry for $wpdb in WP_Network_Query::get_network_ids().
Props afzalmultani.
Fixes #41238.
Built from https://develop.svn.wordpress.org/trunk@41005


git-svn-id: http://core.svn.wordpress.org/trunk@40855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-05 09:23:42 +00:00
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