Commit Graph

123 Commits

Author SHA1 Message Date
Pascal Birchler
4fbb3d6975 Docs: Improve wording and add missing full stops in a few docblocks.
Props shailu25, sabernhardt.
Fixes #60323.
Built from https://develop.svn.wordpress.org/trunk@57719


git-svn-id: http://core.svn.wordpress.org/trunk@57220 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-27 10:29:11 +00:00
Pascal Birchler
f97698702d General: Consistently cast return value to int in functions that use ceil().
The return value of `ceil()` is still of type `float` as the value range of `float` is usually bigger than that of `int`.

Props crstauf, audrasjb.
Fixes #58683.
Built from https://develop.svn.wordpress.org/trunk@57648


git-svn-id: http://core.svn.wordpress.org/trunk@57149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-17 15:24:08 +00:00
Sergey Biryukov
e7865d0001 Docs: Add missing full stop in WP_Comment_Query::parse_query() DocBlock.
Props hardik2221.
Fixes #60323.
Built from https://develop.svn.wordpress.org/trunk@57342


git-svn-id: http://core.svn.wordpress.org/trunk@56848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 22:28:15 +00:00
Sergey Biryukov
b80ce60f70 Coding Standards: Use pre-increment/decrement for stand-alone statements.
Note: This is enforced by WPCS 3.0.0:

1. There should be no space between an increment/decrement operator and the variable it applies to.
2. Pre-increment/decrement should be favoured over post-increment/decrement for stand-alone statements. “Pre” will in/decrement and then return, “post” will return and then in/decrement. Using the “pre” version is slightly more performant and can prevent future bugs when code gets moved around.

References:
* [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#increment-decrement-operators WordPress PHP Coding Standards: Increment/decrement operators]
* [https://github.com/WordPress/WordPress-Coding-Standards/pull/2130 WPCS: PR #2130 Core: add sniffs to check formatting of increment/decrement operators]

Props jrf.
See #59161, #58831.
Built from https://develop.svn.wordpress.org/trunk@56549


git-svn-id: http://core.svn.wordpress.org/trunk@56061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-09 09:28:26 +00:00
Sergey Biryukov
1ce5dc7444 Code Modernization: Replace usage of strpos() with str_contains().
`str_contains()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle).

WordPress core includes a polyfill for `str_contains()` on PHP < 8.0 as of WordPress 5.9.

This commit replaces `false !== strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices.

Follow-up to [52039], [52040], [52326], [55703], [55710], [55987].

Props Soean, spacedmonkey, costdev, dingo_d, azaozz, mikeschroder, flixos90, peterwilsoncc, SergeyBiryukov.
Fixes #58206.
Built from https://develop.svn.wordpress.org/trunk@55988


git-svn-id: http://core.svn.wordpress.org/trunk@55500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 14:36:26 +00:00
spacedmonkey
fda9000c7b Comments: Always lazily load comment meta.
In [34270] introduced lazy loading of comment meta. However, this was only in the context of `WP_Query`. Other parts of the codebase, like `WP_Comment_Query` did not lazily load comment meta. In this change, calls to `update_meta_cache` are now replaced with `wp_lazyload_comment_meta`, that instead of priming comment meta caches, just adds them to the queue to be primed it ever called. This results in far less database queries, as there a number of places where comment meta is being primed unnecessarily and never used. Adding everything to the comment meta queue, also means that if comment meta is used, that is all loaded in a single database / cache call.

Follow on from [55671], [55747].

Props spacedmonkey, peterwilsoncc, flixos90, mukesh27.
Fixes #57801.
Built from https://develop.svn.wordpress.org/trunk@55749


git-svn-id: http://core.svn.wordpress.org/trunk@55261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-11 12:27:22 +00:00
spacedmonkey
90b94aeddc Comments: Use wp_cache_get_multiple in WP_Comment_Query.
In the `fill_descendants` method in `WP_Comment_Query`, there is a loop the calls `wp_cache_get` to get `child comments. Instead of getting one key at a time, use `wp_cache_get_multiple` and get all keys at once.

Props spacedmonkey, tillkruess, mukesh27.
Fixes #57803.
Built from https://develop.svn.wordpress.org/trunk@55607


git-svn-id: http://core.svn.wordpress.org/trunk@55119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-29 10:20:20 +00:00
Sergey Biryukov
123b819f4f Coding Standards: Remove unused variables in WP_Comment_Query.
* `$unapproved_ids` and `$unapproved_emails` in `WP_Comment_Query::get_comment_ids()` were added in [29965] and appear to never have been used.
* `$wpdb` in `WP_Comment_Query::fill_descendants()` was replaced with `$this->db` in [38275], removed in [38446], and accidentally reinstated in [38768].

Follow-up to [29965], [34546], [37625], [38275], [38446], [38768], [44546].

Props upadalavipul, dingo_d, audrasjb, SergeyBiryukov.
Fixes #57482.
Built from https://develop.svn.wordpress.org/trunk@55559


git-svn-id: http://core.svn.wordpress.org/trunk@55071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-18 12:34:21 +00:00
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
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
John Blackbourn
79db573265 Docs: Various corrections and improvements to inline documentation.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 14:52:11 +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
John Blackbourn
6aa053dc01 Docs: Various docblock improvements.
See #54729

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


git-svn-id: http://core.svn.wordpress.org/trunk@52888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-28 09:46:21 +00:00
Peter Wilson
75d1fab217 Comments: Avoid DB error in comment meta queries.
In `WP_Comment_Query` always include the table name when referencing `wp_comments.comment_ID`. This avoids ambiguity in when making meta queries as `wp_commentmeta` includes a column of the same name.

Follow up to [47887].

Props genosseeinhorn, azouamauriac, audrasjb, peterwilsoncc.
Fixes #55218.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-27 04:10:08 +00:00
Sergey Biryukov
69be4c73ff Docs: Add missing documentation for WP_*_Query::get_search_sql() method parameters.
Includes renaming the `$cols` parameter to `$columns` for consistency across the classes.

Follow-up to [42876], [53272-53276].

See #54729.
Built from https://develop.svn.wordpress.org/trunk@53280


git-svn-id: http://core.svn.wordpress.org/trunk@52869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-26 14:04:10 +00:00
Sergey Biryukov
84e3a59385 Code Modernization: Rename parameters that use reserved keywords in wp-includes/class-wp-comment-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_Comment_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].

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


git-svn-id: http://core.svn.wordpress.org/trunk@52861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-26 11:41:10 +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
4b73e7b87b Cache API: Improve cache key generation in WP_Comment_Query.
Discard the parameters `update_comment_meta_cache` and `update_comment_post_cache` when generating the cache key as neither have an effect on the database query generated.

Props uday17035, spacedmonkey.
Fixes #55460.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-13 02:57:14 +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
spacedmonkey
a4026420cc Cache: Use wp_cache_*_multiple() in core functions.
Implement the `wp_cache_add_multiple`, `wp_cache_set_multiple` and `wp_cache_delete_multiple` in a number of core functions after they were introduced in [52700]

Props: spacedmonkey, adamsilverstein, flixos90, mitogh.
Fixes: #55029.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-11 18:51:59 +00:00
John Blackbourn
39bff93b6b Docs: Various inline documentation corrections and improvements.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 12:20:02 +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
hellofromTonya
e838c96df4 Code Modernization: Fix "passing null to non-nullable" deprecation notice in WP_Comment_Query::get_comment_ids().
The `WP_Comment_Query::get_comment_ids()` method is supposed to handle `null` as a search query, but was throwing a `strlen(): Passing null to parameter #1 ($string) of type string is deprecated` notice on PHP 8.1.

Discovered via and already covered via the pre-existing `Tests_Comment_Query::test_search_null_should_be_ignored()` test method.

Follow-up to [36345], [48275].

Props jrf, hellofromTonya.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51806


git-svn-id: http://core.svn.wordpress.org/trunk@51413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-13 18:54: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
John Blackbourn
79685db062 Docs: Corrections and improvements to types used in docblocks for symbols, properties, and filters.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:02:57 +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
f39fc10544 Docs: Use a consistent plural form of "status".
Props Collizo4sky, Presskopp, davidbaumwald.
Fixes #51690.
Built from https://develop.svn.wordpress.org/trunk@49472


git-svn-id: http://core.svn.wordpress.org/trunk@49231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-02 01:38:07 +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
e1a05a42d3 Comments: Assign the array of comment data returned from the comments_pre_query filter to the comments property of the current WP_Comment_Query instance.
This avoids the performance overhead of calling `WP_Comment_Query::get_comments()` twice: first when creating the object instance, then to retrieve the filtered results.

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

Follow-up to [46086].

Props dinhtungdu, imath, spacedmonkey, adamsilverstein, SergeyBiryukov.
Fixes #50521.
Built from https://develop.svn.wordpress.org/trunk@48990


git-svn-id: http://core.svn.wordpress.org/trunk@48752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-17 19:55:08 +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
649348cf5b Code Modernization: Remove unnecessary reference sign from get_comment() definition.
This fixes a PHP 8 "argument must be passed by reference, value given" error when using `array_map( 'get_comment', ... )`.

Object variables in PHP 5+ contain a reference to the object, and it's the reference that's passed around.

Note: This reverts [48838], which is now redundant.

Follow-up to a similar change for `get_post()` in [21572].

See #50913.
Built from https://develop.svn.wordpress.org/trunk@48961


git-svn-id: http://core.svn.wordpress.org/trunk@48723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-09 03:55:07 +00:00
Sergey Biryukov
7ba8aa2bb4 Code Modernization: Fix PHP 8 "argument must be passed by reference, value given" error in WP_Comment_Query::get_comments().
The WP native `get_comment()` function expects the first argument `$comment` to be passed by reference.

The PHP `array_map()` function, however, passes by value, not by reference, resulting in an "arguments must be passed by reference, value given" error.

The PHP native `array_walk()` function does pass by reference. Using this prevents the error on PHP 8 and maintains the existing behaviour on PHP < 8.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-21 21:34: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
57a3f803ae Docs: First pass at some inline docs fixes mostly made by PHPCBF.
See #49572, #50744
Built from https://develop.svn.wordpress.org/trunk@48586


git-svn-id: http://core.svn.wordpress.org/trunk@48348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 20:01:04 +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
ec571bdcf6 Docs: Spell "falsey" in a consistent way.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48275


git-svn-id: http://core.svn.wordpress.org/trunk@48044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-02 11:30: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
whyisjake
9f86174e08 Comments: Ensure that unmoderated comments won't be search indexed.
After a comment is submitted, only allow a brief window where the comment is live on the site. 

Fixes #49956.
Props: jonkolbert, ayeshrajans, Asif2BD, peterwilsoncc, imath, audrasjb, jonoaldersonwp, whyisjake.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-02 20:12:07 +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
6b5087812c Comments: Restore inclusion of an empty comment type when building the WHERE clause in WP_Comment_Query::get_comment_ids().
This ensures that `get_comments( array( 'type' => 'comment' ) )` still includes comments that have not yet migrated to the `comment` type.

Follow-up to [47597].

Props ocean90.
See #49236.
Built from https://develop.svn.wordpress.org/trunk@47625


git-svn-id: http://core.svn.wordpress.org/trunk@47400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-26 13:14:06 +00:00
Sergey Biryukov
61a2f62ffd Comments: Use comment instead of an empty string for the comment_type DB field value in comments table.
This is the first step to bring support for custom comment types into WordPress.

Add a scheduled upgrade routine to update the type value for existing comments, in batches of 100 at a time.

Props imath, aaroncampbell, jeremyfelt, dshanske.
Fixes #49236.
Built from https://develop.svn.wordpress.org/trunk@47597


git-svn-id: http://core.svn.wordpress.org/trunk@47372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-17 19:35:06 +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