Commit Graph

50 Commits

Author SHA1 Message Date
Sergey Biryukov c03305852e Code Modernization: Add `AllowDynamicProperties` attribute to all (parent) classes.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.

Trac ticket #56034 is open to investigate and handle the third and fourth type of situations, however it has become clear this will need more time and will not be ready in time for WP 6.1.

To reduce “noise” in the meantime, both in the error logs of WP users moving onto PHP 8.2, in the test run logs of WP itself, in test runs of plugins and themes, as well as to prevent duplicate tickets from being opened for the same issue, this commit adds the `#[AllowDynamicProperties]` attribute to all “parent” classes in WP.

The logic used for this commit is as follows:
* If a class already has the attribute: no action needed.
* If a class does not `extend`: add the attribute.
* If a class does `extend`:
 - If it extends `stdClass`: no action needed (as `stdClass` supports dynamic properties).
 - If it extends a PHP native class: add the attribute.
 - If it extends a class from one of WP's external dependencies: add the attribute.
* In all other cases: no action — the attribute should not be needed as child classes inherit from the parent.

Whether or not a class contains magic methods has not been taken into account, as a review of the currently existing magic methods has shown that those are generally not sturdy enough and often even set dynamic properties (which they should not). See the [https://www.youtube.com/watch?v=vDZWepDQQVE live stream from August 16, 2022] for more details.

This commit only affects classes in the `src` directory of WordPress core.
* Tests should not get this attribute, but should be fixed to not use dynamic properties instead. Patches for this are already being committed under ticket #56033.
* While a number bundled themes (2014, 2019, 2020, 2021) contain classes, they are not a part of this commit and may be updated separately.

Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].

Follow-up to [53922].

Props jrf, hellofromTonya, markjaquith, peterwilsoncc, costdev, knutsp, aristath.
See #56513, #56034.
Built from https://develop.svn.wordpress.org/trunk@54133


git-svn-id: http://core.svn.wordpress.org/trunk@53692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 15:47:14 +00:00
Sergey Biryukov 5b2c18d295 Docs: Add a `@since` note for the `update_network_meta_cache` parameter of `WP_Network_Query::__construct()`.
Follow-up to [54080].

See #55646.
Built from https://develop.svn.wordpress.org/trunk@54082


git-svn-id: http://core.svn.wordpress.org/trunk@53641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 14:21:10 +00:00
Sergey Biryukov df56131c6a Docs: Simplify a comment in `WP_Network_Query::get_networks()` and `WP_Site_Query::get_sites()`.
This aims to improve readability. The arguments ignored are listed in the line directly below, so there is no need to mention them twice.

Follow-up to [41059], [41063], [53097], [53098], [54080].

See #55646.
Built from https://develop.svn.wordpress.org/trunk@54081


git-svn-id: http://core.svn.wordpress.org/trunk@53640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 13:59:13 +00:00
spacedmonkey 8d1156f066 Networks and Sites: Use metadata api in ``*_network_options` functions.
Replace logic found in `get_network_option`, `update_network_option` and `delete_network_option` to use the metadata api. Using the metadata api has a number of benefits, such as consistency, default values and useful filters. This change also improves performance by priming the caches of all network options in a single database request. 

Props spacedmonkey, swissspidy, sc0ttkclark, johnjamesjacoby, flixos90, jeremyfelt, pento, peterwilsoncc, mukesh27, desrosj.
Fixes #37181
Built from https://develop.svn.wordpress.org/trunk@54080


git-svn-id: http://core.svn.wordpress.org/trunk@53639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 11:28:13 +00:00
Sergey Biryukov cb2d81f6df Coding Standards: Restore the `$pieces` variable for SQL clauses in query classes.
This is a defensive coding measure that aims to reduce confusion. With this change, `$pieces` is explicitly used for the names, and `$clauses` for the values of the clauses.

Follow-up to [52974], [53175], [53370], [53375].

Props peterwilsoncc.
See #55699.
Built from https://develop.svn.wordpress.org/trunk@53376


git-svn-id: http://core.svn.wordpress.org/trunk@52965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-10 11:21:09 +00:00
Sergey Biryukov 27eff4bd87 Code Modernization: Rename parameters that use reserved keywords in `wp-includes/class-wp-network-query.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$string` parameter to `$search` in `WP_Network_Query::get_search_sql()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53273


git-svn-id: http://core.svn.wordpress.org/trunk@52862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-26 11:43:07 +00:00
Sergey Biryukov ed4829b0ee Query: Restore late `compact()` call for SQL clauses in `wp-includes/class-wp-*-query.php`.
This addresses a backward compatibility break where `posts_groupby` and other filters were applied, but their results were subsequently discarded and earlier values were used instead.

Follow-up to [52974].

Props nextend_ramona.
See #54728, #meta6273.
Built from https://develop.svn.wordpress.org/trunk@53175


git-svn-id: http://core.svn.wordpress.org/trunk@52764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-14 00:04:11 +00:00
spacedmonkey 4a14685afd Networks and Sites: Improve cache key generation in `WP_Network_Query` class.
Improve cache key generation in the `WP_Network_Query` class by removing `update_network_cache` element in the array used to generate the cache key.  This 
element does not affect that cache and by removing it, it improves the likelihood of reusing an existing cache. 

Props Spacedmonkey, furi3r, johnbillion, johnjamesjacoby, flixos90.
Fixes #55461.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-07 17:59:04 +00:00
Sergey Biryukov 6f5f187574 Coding Standards: Use multi-line strings for the `$this->request` property in `wp-includes/class-wp-*-query.php`.
This further improves the readability by replacing `implode()` calls with string interpolation.

Follow-up to [52973].

Props jrf.
See #54728.
Built from https://develop.svn.wordpress.org/trunk@52977


git-svn-id: http://core.svn.wordpress.org/trunk@52566 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-22 14:56:05 +00:00
Sergey Biryukov 41de51364a Coding Standards: Remove a one-time `$pieces` variable in `wp-includes/class-wp-*-query.php`.
Use the existing `$clauses` variable instead for consistency.

See #54728.
Built from https://develop.svn.wordpress.org/trunk@52974


git-svn-id: http://core.svn.wordpress.org/trunk@52563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-21 12:22:01 +00:00
Sergey Biryukov 38dbd506e7 Coding Standards: Wrap the `$this->request` property in `wp-includes/class-wp-*-query.php`.
This aims to improve readability by fitting the values on a single screen to avoid horizontal scrolling. 

See #54728.
Built from https://develop.svn.wordpress.org/trunk@52973


git-svn-id: http://core.svn.wordpress.org/trunk@52562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-21 12:05:04 +00:00
John Blackbourn 2cb4ebefe2 Docs: Replace `$this` in hook param docs with more appropriate names.
`$this` is a pseudo-variable that cannot be used as the name of a function parameter, so renaming these helps prevent errors when implementing hook callback functions.

Fixes #53457

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


git-svn-id: http://core.svn.wordpress.org/trunk@51129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-30 19:35:58 +00:00
John Blackbourn 6f3a940e64 Plugins: Replace usage of `$this` in action and filter parameter docblocks with more appropriate variable names.
See #51800, #52217

Fixes #52243

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


git-svn-id: http://core.svn.wordpress.org/trunk@49645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-08 14:30:14 +00:00
John Blackbourn f4cda1b62f Docs: Upgrade more parameters in docblocks to used typed array notation.
See #51800, #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@49416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-24 21:27:05 +00:00
John Blackbourn 35f6c356c1 Docs: Document parameters that accept an array of integers using typed array notation.
While many of these parameters also technically accept an array of numerical strings, they are all ultimately cast to an array of integers. Documenting them as such assists developers in understanding the expected types.

See #51800, #41756

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


git-svn-id: http://core.svn.wordpress.org/trunk@49395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-19 18:24:09 +00:00
Sergey Biryukov 4a18c93f42 Networks and Sites: Assign the array of site or network data returned from filters to the respective class property:
* The array of network data returned from the `networks_pre_query` filter is assigned to the `networks` property of the current `WP_Network_Query` instance.
* The array of site data returned from the `sites_pre_query` filter is assigned to the `sites` property of the current `WP_Site_Query` instance.

This avoids the performance overhead of calling `WP_Network_Query::get_networks()` or `WP_Site_Query::get_sites()` twice: first when creating the object instance, then to retrieve the filtered results.

This also makes the filters a bit more consistent with other similar filters, e.g. `posts_pre_query`, `terms_pre_query`, `comments_pre_query`, or `users_pre_query`.

Follow-up to [46086], [48990].

Props yakimun, spacedmonkey.
Fixes #51333.
Built from https://develop.svn.wordpress.org/trunk@49538


git-svn-id: http://core.svn.wordpress.org/trunk@49276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-08 11:47:06 +00:00
Sergey Biryukov 897f004a9c General: Replace older-style PHP type conversion functions with type casts.
This improves performance, readability, and consistency throughout core.

* `intval()` → `(int)`
* `strval()` → `(string)`
* `floatval()` → `(float)`

Props ayeshrajans.
Fixes #42918.
Built from https://develop.svn.wordpress.org/trunk@49108


git-svn-id: http://core.svn.wordpress.org/trunk@48870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-08 21:15:13 +00:00
Sergey Biryukov e01409866e Docs: Reformat `comments_pre_query`, `networks_pre_query`, `sites_pre_query` DocBlocks for better readability.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48986


git-svn-id: http://core.svn.wordpress.org/trunk@48748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 11:10:03 +00:00
Sergey Biryukov b66ff2f68d Docs: Fix typo in `*_pre_query` filter DocBlocks.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48985


git-svn-id: http://core.svn.wordpress.org/trunk@48747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 10:45:03 +00:00
Sergey Biryukov 06e53b90a1 Docs: Correct the parameter type for `networks_pre_query` filter.
The filter should return the network count as an integer if `$this->query_vars['count']` is set.

Follow-up to [46100].

See #50768, #47599.
Built from https://develop.svn.wordpress.org/trunk@48984


git-svn-id: http://core.svn.wordpress.org/trunk@48746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 10:37:05 +00:00
Sergey Biryukov 1f85e7484f Docs: Consistently use third-person singular verbs for various filter descriptions, per the documentation standards.
See #50768.
Built from https://develop.svn.wordpress.org/trunk@48782


git-svn-id: http://core.svn.wordpress.org/trunk@48544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-11 00:34:08 +00:00
Sergey Biryukov e13c363b17 Docs: Capitalize "ID", when referring to a post ID, term ID, etc. in a more consistent way.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48104


git-svn-id: http://core.svn.wordpress.org/trunk@47873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:02:12 +00:00
Sergey Biryukov a576a13246 Docs: Remove an empty line between `@param` and `@return` tags, per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48102


git-svn-id: http://core.svn.wordpress.org/trunk@47871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 11:18:09 +00:00
Sergey Biryukov 7932193708 Coding Standards: Use strict comparison where static strings are involved.
This reduces the number of `WordPress.PHP.StrictComparisons.LooseComparison` issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47808


git-svn-id: http://core.svn.wordpress.org/trunk@47584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-16 18:42:12 +00:00
Sergey Biryukov 38676936ba Coding Standards: Use strict type check for `in_array()` and `array_search()` where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47550


git-svn-id: http://core.svn.wordpress.org/trunk@47325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-05 03:02:11 +00:00
Sergey Biryukov 641c632b0c Coding Standards: Use Yoda conditions where appropriate.
See #49222.
Built from https://develop.svn.wordpress.org/trunk@47219


git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-09 16:55:09 +00:00
Sergey Biryukov 001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Adam Silverstein 67fd6e281f Multisite: improve `sites_pre_query` and `networks_pre_query` filters, avoiding db queries.
Improve the `pre_query` filters in multisite classes introduced in r44983. Return (non null) values immediately,
avoiding the database queries entirely, similar to other `pre_query` filters.

Props spacedmonkey, SergeyBiryukov, felipeelia.
Fixes #47599.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-12 22:17:55 +00:00
Sergey Biryukov c9071ca2e6 Docs: Clarify the `int` return value in `comments_pre_query` filter DocBlock.
See #45800.
Built from https://develop.svn.wordpress.org/trunk@46087


git-svn-id: http://core.svn.wordpress.org/trunk@45899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-10 19:04:56 +00:00
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