Commit Graph

64 Commits

Author SHA1 Message Date
spacedmonkey 1bf93a87a4 Cache API: Introduce new queries cache groups.
Give developers more control over how query caches are handled within an object caches. Now all caches that cache the result of a query, are cached in a group that is suffixed with -queries. Developers can use these groups, to add custom cache invalidation rules or to make them none persistent.

Props spacedmonkey, owi, tillkruess, skithund, peterwilsoncc, flixos90, sergeybiryukov, mukesh27.
Fixes #57625.
Built from https://develop.svn.wordpress.org/trunk@55526


git-svn-id: http://core.svn.wordpress.org/trunk@55048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-10 16:30:03 +00:00
davidbaumwald 1664e1a05f Networks and Sites: Revert the use of the metadata API for `*_network_options` functions.
[54080] refactored the logic in `get_network_option()`, `update_network_option()` and `delete_network_option()` to use the metadata API. However, this change resulted in issues with large multisite installs that utilize memcached having network options > 1MB in size.

This change reverts [54080] and all related follow-up changes.

Reverts [54080], [54081], and [54082].  Partially reverts [54267] and [54402].

Props pavelschoffer, rebasaurus, johnbillion, spacedmonkey, desrosj, rinatkhaziev.
Fixes #56845.
See #37181.
Built from https://develop.svn.wordpress.org/trunk@54637


git-svn-id: http://core.svn.wordpress.org/trunk@54189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-18 18:16:16 +00:00
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 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
Sergey Biryukov 73a2d87eae Docs: Add a comment for stripping the leading `AND` from SQL clauses in some query classes.
Follow-up to [30084], [34529], [34542], [36598], [37477], [37572], [43010].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 16:17:08 +00:00
Sergey Biryukov a29a0e05d1 Docs: Correct method reference format in some DocBlocks.
This ensures that the methods are recognized by the WordPress Code Reference parser.

Follow-up to [7994], [25567], [27156], [28887], [49672], [52226].

Props dd32, audrasjb.
Fixes #55928.
Built from https://develop.svn.wordpress.org/trunk@53469


git-svn-id: http://core.svn.wordpress.org/trunk@53058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 10:51:12 +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 e333f174de Code Modernization: Rename parameters that use reserved keywords in `wp-includes/class-wp-site-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_Site_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], [53273].

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


git-svn-id: http://core.svn.wordpress.org/trunk@52863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-26 11:44:15 +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
Peter Wilson 395f39aee4 Networks and Sites: Increase sort options in `WP_Site_Query`.
Add orderby support for the boolean options: deleted, spam, mature, archived and public.

Props lenasterg, SergeyBiryukov.
Fixes #55226.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-08 06:36:03 +00:00
spacedmonkey 7aad7bef06 Networks and Sites: Improve cache key generation in `WP_Site_Query` class.
Improve cache key generation in the `WP_Site_Query` class by removing `update_site_cache` and `update_site_meta_cache` elements in the array used to generate 
the cache key.  These elements do not affect that cache and by removing them, improve the likelihood of reusing an existing cache. 

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


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


git-svn-id: http://core.svn.wordpress.org/trunk@52686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-07 17:46: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 fa62df0774 Query: Correct and standardise the meta query documentation.
Also improves the formatting of some surrounding documentation.

Props audrasjb, johnbillion

Fixes #53467

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


git-svn-id: http://core.svn.wordpress.org/trunk@51818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-20 00:07:59 +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
Sergey Biryukov 6c01c2a864 Docs: Add a reference to `WP_Site_Query::__construct()` for information on accepted arguments in `get_sites()`.
Synchronize the documentation between two places, use `WP_Site_Query::__construct()` as the canonical source.

Follow-up to [37616].

Props birgire, felipeelia, audrasjb.
Fixes #42156.
Built from https://develop.svn.wordpress.org/trunk@51184


git-svn-id: http://core.svn.wordpress.org/trunk@50793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-19 20:57:01 +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 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
John Blackbourn 124972f2c6 Docs: Further corrections and improvements to various inline docblocks.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48576


git-svn-id: http://core.svn.wordpress.org/trunk@48338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 07:39:02 +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 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 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
Felix Arntz 035877708d Multisite: Update `@since` tags for site meta introduction.
Fixes #37923. Fixes #40229.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-08 08:18:50 +00:00
desrosj d6c74f0a32 Networks and Sites: Fix incorrect variable location.
This fixes an issue introduced in [44166] where the `$groupby` variable was inserted too low in the `get_site_ids()` function while merging [43832] into `trunk`. The merged location did not account for a new conditional statement that existed only in `trunk`, and would have resulted in values assigned to `$groupby` being erased in certain scenarios.

Props spacedmonkey.

See #44416.
Fixes #45582.
Built from https://develop.svn.wordpress.org/trunk@44186


git-svn-id: http://core.svn.wordpress.org/trunk@44016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-15 11:02:18 +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
Felix Arntz af6704edad Multisite: Add meta query functionality to `WP_Site_Query`.
After the introduction of site metadata in [42836], it should be possible to query sites by that data.

Fixes #40229.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-27 11:41:22 +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
Felix Arntz 176a289050 Multisite: Introduce metadata for sites.
A new global multisite table `wp_blogmeta` is added to the database schema, and a set of `*_site_meta()` API functions are introduced.

The implementation fails gracefully when the new table is not yet available, which may happen especially shortly after the core update, before the network has been upgraded to the new database schema. The presence of the table is detected once and stored as a global setting on the main network.

Core does not yet use site metadata, but there are several use-cases to be implemented or explored in the near future, and it allows plugins to extend sites with arbitrary data, which will come in particularly handy with the upcoming REST API endpoint for sites.

Props spacedmonkey, johnjamesjacoby, jeremyfelt, flixos90.
Fixes #37923.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-16 02:15: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
Jeremy Felt 548d8c2e0d Multisite: Document all return types in `get_sites()`.
Adds more complete documentation to `get_sites()` and the corresponding methods in `WP_Site_Query`.

Fixes #41789.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-18 17:39:46 +00:00
John Blackbourn b25e759621 Networks and Sites: Correct the documentation for the `update_site_cache` parameter of `WP_Site_Query`.
Props welcher, sudar
Fixes #42155

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


git-svn-id: http://core.svn.wordpress.org/trunk@41629 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-09 14:26:49 +00:00
Jeremy Felt 7e190e496b Multisite: Use `%s` when building query for `archived` sites in `WP_Site_Query`.
In [25548], the `archived` column in `wp_blogs` was changed from `ENUM` to `TINYINT` to match other status fields. When `WP_Site_Query` was written later, it used `%d` as a placeholder when formatting the archived status.

It is possible that this query will fail for any installations that did not update the schema for `wp_blogs` as only single quoted values are accepted for the `ENUM` type. In this case, `'0'` or `'1'` rather than `0` or `1`.

We can work around this and support both `ENUM` and `TINYINT` in the query by using the `%s` placeholder and casting the value with `absint()`.

Props stephdau.
Fixes #38856. See #27832.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-03 04:40:46 +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 f66864af2e Multisite: More specificity for the `get_sites()` documentation.
See #41789

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


git-svn-id: http://core.svn.wordpress.org/trunk@41164 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-04 11:17:43 +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 af50e8eb2c Multisite: Improve caching in `WP_Site_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.

Props spacedmonkey.
Fixes #41197.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-14 21:25:44 +00:00
Jeremy Felt f940beae2b Multisite: Add `lang_id` support to `WP_Site_Query`.
Sites can now be queried by `lang_id`, `lang__in`, and `lang__not_in`.

Props ocean90.
Fixes #40196.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-27 19:48:52 +00:00