Commit Graph

45 Commits

Author SHA1 Message Date
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
4bdd4edb77 Comments: in WP_Comment_Query::fill_descendants(), continue if there is an empty array in the loop.
See #37416, [38297].

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


git-svn-id: http://core.svn.wordpress.org/trunk@38239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-21 06:43:29 +00:00
Scott Taylor
f02f4ac762 Comments: in WP_Comment_Query::fill_descendants(), compute count() in the first for expression so that it does not run on each iteration.
Props vishalkakadiya, deremohan.
Fixes #37416.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-21 06:25: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
Drew Jaynes
6cc13f0c54 Docs: Fix formatting, tense, verb conjugation, and other syntax for wp-includes/* elements introduced or changed in 4.6.
Part 1/2.

See #37318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@38062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 16:57:32 +00:00
Sergey Biryukov
c50056a1f2 Comments: Introduce the cache_domain argument for WP_Comment_Query to allow caching to a unique set of cache buckets.
See [18128] for `get_terms()` and [37572] for `WP_Term_Query`.

Props Chouby, rachelbaker.
Fixes #37419.
Built from https://develop.svn.wordpress.org/trunk@38117


git-svn-id: http://core.svn.wordpress.org/trunk@38058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-20 15:07:30 +00:00
Boone Gorges
c6d5f78241 Comments: Cache results of SELECT FOUND_ROWS() query.
When comment IDs are fetched from the cache rather than the database,
the subsequent `SELECT FOUND_ROWS()` query will not return the correct value.
To avoid unnecessary queries, we cache the results of the `found_comments`
query alongside the comment IDs.

Props spacedmonkey.
Fixes #37184.
Built from https://develop.svn.wordpress.org/trunk@38001


git-svn-id: http://core.svn.wordpress.org/trunk@37942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-07 14:27:38 +00:00
Sergey Biryukov
bf2bea4987 Comments: Remove the assignment of an undocumented $comment_count property in WP_Comment_Query::get_comments(), which appears to be accidentally introduced in [34544].
Props flixos90.
Fixes #37187.
Built from https://develop.svn.wordpress.org/trunk@37873


git-svn-id: http://core.svn.wordpress.org/trunk@37814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-26 14:28:28 +00:00
Boone Gorges
e202610ac8 Comments: Improve caching for hierarchical queries.
Hierarchical comment queries work by first fetching the IDs of top-level
comments, and then filling the descendant tree one level at a time based on the
top-level results. When top-level comment IDs are found in the cache,
`WP_Comment_Query` does not generate the SQL used to fetch these comments. In
this case, the `fill_descendants()` query does not have enough information
to fill children. As a result, descendant comments were failing to be filled
in cases where the top-level comments were found in the cache.

This was a minor bug previously, because comment caches were not maintained
between pageloads. Since comment caches are now persistent [37613], the problem
becomes evident anywhere that a persistent object cache is in use.

The solution is to cache parent-child relationships, so that when top-level
comments are found in the cache, descendant comments should be found there as
well.

Fixes #36487.
Built from https://develop.svn.wordpress.org/trunk@37625


git-svn-id: http://core.svn.wordpress.org/trunk@37593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-02 18:28:27 +00:00
Drew Jaynes
fb6d8bae49 Docs: Apply inline @see tags to hooks referenced in DocBlocks for core classes.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

See #36921.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 18:54:27 +00:00
Drew Jaynes
602b51a209 Docs: Standardize filter docs in core classes in wp-includes/* to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:15:28 +00:00
Boone Gorges
e79d2a1bad Improve @return documentation for WP_Comment_Query::get_comments().
Props barryceelen.
Fixes #36896.
Built from https://develop.svn.wordpress.org/trunk@37482


git-svn-id: http://core.svn.wordpress.org/trunk@37450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 16:21:27 +00:00
Drew Jaynes
b1804afeaf Docs: Standardize on 'backward compatibility/compatible' nomenclature in core inline docs.
Also use 'back-compat' in some inline comments where backward compatibility is the subject and shorthand feels more natural.

Note: 'backwards compatibility/compatibile' can also be considered correct, though it's primary seen in regular use in British English.

Props ocean90.
Fixes #36835.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-13 18:41:31 +00:00
Drew Jaynes
c7a2b7683b Docs: Add a missing hook doc for the parse_comment_query hook, added in [31793].
Props flixos90.
See #24826. Fixes #36740.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-03 16:22:27 +00:00
Boone Gorges
2f66998e3f date_query should be a property on WP_Comment_Query objects.
Instead of a local variable.

Props flixos90.
Fixes #36741.
Built from https://develop.svn.wordpress.org/trunk@37354


git-svn-id: http://core.svn.wordpress.org/trunk@37320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-03 16:15:29 +00:00
Drew Jaynes
4a171993ed Docs: Standardize the changelog entry for the new $author_url argument, introduced in [36224].
See #35377. See #35986.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-03 16:02:27 +00:00
Boone Gorges
146320744f Allow comments to be queried by 'any' post_type or post_status.
Props kouratoras.
Fixes #35512.
Built from https://develop.svn.wordpress.org/trunk@36486


git-svn-id: http://core.svn.wordpress.org/trunk@36453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-06 04:51:25 +00:00
Boone Gorges
b5d12e130c Comments: Restore the ability to bypass post_id filter using 0 or '0'.
The changes introduced in [36381], while logical and clearly awesome, introduce
the potential for much breakage. Those who want to query for comments with a
null `comment_post_ID` should use `'post_in' => array( 0 )` instead.

Reverts [36381], [36387].
See #35090.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-05 18:50:25 +00:00
Boone Gorges
8e5cf1c2fe Comments: Add 'parent__in' and 'parent__not_in' to query var defaults.
Query var defaults are used to calculate a cache key. The fact that these
params were not listed among the defaults was causing cache keys to be
insufficiently specific.

Props danielbachhuber.
Fixes #35677.
Built from https://develop.svn.wordpress.org/trunk@36479


git-svn-id: http://core.svn.wordpress.org/trunk@36446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-05 18:36:28 +00:00
Boone Gorges
c5ab953773 Allow comment query results to be limited to comments with comment_post_ID = 0.
Previously, this was not possible due to an overly broad `empty()` check.

Passing `null`, `false`, or `''` to 'post_id', or omitting 'post_id'
altogether, will continue to return comments regardless of `comment_post_ID`,
as before. Passing `0` or `'0'` will limit results to comments with no
associated post.

Props danielbachhuber.
Fixes #35090.
Built from https://develop.svn.wordpress.org/trunk@36381


git-svn-id: http://core.svn.wordpress.org/trunk@36348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-22 20:20:25 +00:00
Boone Gorges
a2c17d92d2 Ignore false values of 'search' in WP_Comment_Query.
Props danielbachhuber.
Fixes #35513.
Built from https://develop.svn.wordpress.org/trunk@36345


git-svn-id: http://core.svn.wordpress.org/trunk@36312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-19 02:55:27 +00:00
Boone Gorges
b750ee042b Correct documentation for post_author param of WP_Comment_Query.
Props chriscct7.
Fixes #35481.
Built from https://develop.svn.wordpress.org/trunk@36327


git-svn-id: http://core.svn.wordpress.org/trunk@36294 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-15 20:14:26 +00:00
Boone Gorges
4c91776f3b Respect all post-related filters in WP_Comment_Query.
The refactor of `WP_Comment_Query`'s SQL generation in [34542] introduced a bug
that caused only the last post-related filter to be respected in comment
queries. In other words, if querying for comments using params
`post_status=draft&post_author=3`, only the last-processed of these params
would be respected. The current changeset fixes the logic so that these clauses
don't overwrite each other.

Props chriscct7.
Fixes #35478.
Built from https://develop.svn.wordpress.org/trunk@36326


git-svn-id: http://core.svn.wordpress.org/trunk@36293 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-15 20:10:51 +00:00
Boone Gorges
98fb5f0bdb Use the post-filter WHERE clause when querying for comment descendants.
The descendant query in `WP_Comment_Query::fill_descendants()` uses the clauses
of the main `get_comment_ids()` query as a basis, discarding the `parent`,
`parent__in`, and `parent__not_in` clauses. As implemented in WP 4.4 [34546],
the WHERE clause was assembled in such a way that any modifications applied
using the `comments_clauses` filter were not inherited by `fill_descendants()`.
This resulted in descendant queries that did not always properly filter
results, and sometimes contained syntax errors.

The current changeset fixes the problem by using the post-filter WHERE clause
as the basis for the `fill_descendants()` query. This change requires a new
approach for eliminating the unneeded parent-related clauses: instead of
eliminating values in an associative array, we must use regular expressions.

Props boonebgorges, firebird75.
Fixes #35192.
Built from https://develop.svn.wordpress.org/trunk@36277


git-svn-id: http://core.svn.wordpress.org/trunk@36244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-13 04:01:26 +00:00
Boone Gorges
5b4b4fc479 Introduce 'author_url' param to WP_Comment_Query.
Props swissspidy.
Fixes #35377.
Built from https://develop.svn.wordpress.org/trunk@36224


git-svn-id: http://core.svn.wordpress.org/trunk@36191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-08 21:52:27 +00:00
Boone Gorges
939291df9f Ensure that order is specified when querying for comment descendants.
Props tellyworth.
Fixes #34838.
Built from https://develop.svn.wordpress.org/trunk@35757


git-svn-id: http://core.svn.wordpress.org/trunk@35721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-03 15:50:27 +00:00
Boone Gorges
5c1ca9d943 WP_Comment_Query: Fill comment objects from database when cache is unavailable.
This fixes a bug where widgets loaded in a preview or the Customizer are
rendered inside of a `wp_suspend_cache_addition()` block and thus could not
find comment objects in the cache.

Props rommelxcastro, stevehenty.
Fixes #34138.
Built from https://develop.svn.wordpress.org/trunk@35512


git-svn-id: http://core.svn.wordpress.org/trunk@35476 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-04 21:09:27 +00:00
Drew Jaynes
217b661703 Docs: Add missing descriptions for the $wpdb global in DocBlocks all the places.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-14 23:44:25 +00:00
Boone Gorges
b2f253fc8e Prevent extra db queries in WP_Comment::get_children().
`WP_Comment_Query::fill_descendants()` queries for a comment tree in a way that
minimizes database overhead, and places the located descendants with their
proper parents. However, it doesn't touch leaf nodes - comments with no
children - so future calls to `get_children()` on those comment objects
result in unnecessary database queries. To prevent this, `fill_descendants()`
now sets a `populated_children` flag on all located `WP_Comment` objects.

See #8071.
Built from https://develop.svn.wordpress.org/trunk@34730


git-svn-id: http://core.svn.wordpress.org/trunk@34694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-01 03:58:23 +00:00
Boone Gorges
9f36a943b5 Improve post field lazyloading for comments.
[34583] modified comment queries so that all post fields are no longer loaded
by default. Instead, they are loaded only when requested on individual comment
objects. This changeset improves that flow:

* `WP_Comment` magic methods `__isset()` and `__get()` should only load the post when a post field is being requested.
* The new `update_comment_post_cache` argument for `WP_Comment_Query` allows developers to specify that, when comments are queried, all of the posts matching those comments should be loaded into cache with a single DB hit. This parameter defaults to false, since typical comment queries are linked to a single post.

Fixes #27571.
Built from https://develop.svn.wordpress.org/trunk@34599


git-svn-id: http://core.svn.wordpress.org/trunk@34563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-26 16:02:25 +00:00
Boone Gorges
18d6b3c8dc Force comment pagination on single posts.
Previously, the 'page_comments' toggle allowed users to disable comment
pagination. This toggle was only superficial, however. Even with
'page_comments' turned on, `comments_template()` loaded all of a post's
comments into memory, and passed them to `wp_list_comments()` and
`Walker_Comment`, the latter of which produced markup for only the
current page of comments. In other words, it was possible to enable
'page_comments', thereby showing only a subset of a post's comments on a given
page, but all comments continued to be loaded in the background. This technique
scaled poorly. Posts with hundreds or thousands of comments would load slowly,
or not at all, even when the 'comments_per_page' setting was set to a
reasonable number.

Recent changesets have addressed this problem through more efficient tree-
walking, better descendant caching, and more selective queries for top-level
post comments. The current changeset completes the project by addressing the
root issue: that loading a post causes all of its comments to be loaded too.

Here's the breakdown:

* Comment pagination is now forced. Setting 'page_comments' to false leads to evil things when you have many comments. If you want to avoid pagination, set 'comments_per_page' to something high.
* The 'page_comments' setting has been expunged from options-discussion.php, and from places in the codebase where it was referenced. For plugins relying on 'page_comments', we now force the value to `true` with a `pre_option` filter.
* `comments_template()` now queries for an appropriately small number of comments. Usually, this means the `comments_per_page` value.
* To preserve the current (odd) behavior for comment pagination links, some unholy hacks have been inserted into `comments_template()`. The ugliness is insulated in this function for backward compatibility and to minimize collateral damage. A side-effect is that, for certain settings of 'default_comments_page', up to 2x the value of `comments_per_page` might be fetched at a time.
* In support of these changes, a `$format` parameter has been added to `WP_Comment::get_children()`. This param allows you to request a flattened array of comment children, suitable for feeding into `Walker_Comment`.
* `WP_Query` loops are now informed about total available comment counts and comment pages by the `WP_Comment_Query` (`found_comments`, `max_num_pages`), instead of by `Walker_Comment`.

Aside from radical performance improvements in the case of a post with many
comments, this changeset fixes a bug that caused the first page of comments to
be partial (`found_comments` % `comments_per_page`), rather than the last, as
you'd expect.

Props boonebgorges, wonderboymusic.
Fixes #8071.
Built from https://develop.svn.wordpress.org/trunk@34561


git-svn-id: http://core.svn.wordpress.org/trunk@34525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 20:40:25 +00:00
Boone Gorges
07dab62c98 Remove debug cruft, introduced in [34546].
Props ocean90.
See #8071.
Built from https://develop.svn.wordpress.org/trunk@34549


git-svn-id: http://core.svn.wordpress.org/trunk@34513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 15:26:25 +00:00
Boone Gorges
d0185d4dde Normalize whitespace in WP_Comment_Query documentation.
Built from https://develop.svn.wordpress.org/trunk@34548


git-svn-id: http://core.svn.wordpress.org/trunk@34512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 15:25:25 +00:00
Boone Gorges
fc854a837f Introduce hierarchical query support to WP_Comment_Query.
Comments can be threaded. Now your query can be threaded too! Bonus: it's
not totally insane.

* The new `$hierarchical` parameter for `WP_Comment_Query` accepts three values:
  * `false` - Default value, and equivalent to current behavior. No descendants are fetched for matched comments.
  * `'flat'` - `WP_Comment_Query` will fetch the descendant tree for each comment matched by the query paramaters, and append them to the flat array of comments returned. Use this when you have a separate routine for constructing the tree - for example, when passing a list of comments to a `Walker` object.
  * `'threaded'` - `WP_Comment_Query` will fetch the descendant tree for each comment, and return it in a tree structure located in the `children` property of the `WP_Comment` objects.
* `WP_Comment` now has a few utility methods for fetching the descendant tree (`get_children()`), fetching a single direct descendant comment (`get_child()`), and adding anothing `WP_Comment` object as a direct descendant (`add_child()`). Note that `add_child()` only modifies the comment object - it does not touch the database.

Props boonebgorges, wonderboymusic.
See #8071.
Built from https://develop.svn.wordpress.org/trunk@34546


git-svn-id: http://core.svn.wordpress.org/trunk@34510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 15:13:24 +00:00
Boone Gorges
fea3051f54 Improve pagination internals in WP_Comment_Query.
`WP_Comment_Query` will now report the total number of comments matching the
query params (`comments_found`), as well as the total number of pages required
to display these comments (`max_num_pages`). Because `SQL_CALC_FOUND_ROWS`
queries can introduce a lot of overhead in some cases, we disable the feature
by default. Pass `no_found_rows=false` to `WP_Comment_Query` to enable the
count. (We use the negative parameter name 'no_found_rows' for parity with
`WP_Query`.)

Props wonderboymusic, boonebgorges.
See #8071.
Built from https://develop.svn.wordpress.org/trunk@34544


git-svn-id: http://core.svn.wordpress.org/trunk@34508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 14:35:24 +00:00
Boone Gorges
4b467a2698 Store SQL clauses in WP_Comment_Query property.
This small syntax change paves the way for some improvements related to #8071.
Built from https://develop.svn.wordpress.org/trunk@34542


git-svn-id: http://core.svn.wordpress.org/trunk@34506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 14:09:25 +00:00
Drew Jaynes
35977a06e7 Docs: The Comments subpackage is plural.
See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 13:45:26 +00:00
Drew Jaynes
8df8fb6046 Docs: The Comment API is singular.
See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-22 13:43:25 +00:00
Boone Gorges
c6c9f8ad26 Split the comment query.
`WP_Comment_Query` now fetches comments in two stages: (1) a query to get the
IDs of comments matching the query vars, and (2) a query to populate the
objects corresponding to the matched IDs. The two queries are cached
separately, so that sites with persistent object caches will continue to have
complete cache coverage for normal comment queries.

Splitting the query allows our cache strategy to be more modest and precise, as
full comment data is only stored once per comment. It also makes it possible
to introduce logic for paginated threading, which is necessary to address
certain performance problems.

See #8071.
data is only stored once per comment, instead of along with
Built from https://develop.svn.wordpress.org/trunk@34310


git-svn-id: http://core.svn.wordpress.org/trunk@34274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-18 19:28:51 +00:00
Boone Gorges
bb43f72692 Prime comment meta caches in WP_Comment_Query.
The new 'update_comment_meta_cache' parameter, which defaults to `true`, can
be used to disable this behavior.

`update_comment_cache()` has been updated to support an `$update_meta_cache`
parameter, which also updates to true; this matches the pattern we use for
priming post caches.

See #16894.
Built from https://develop.svn.wordpress.org/trunk@34268


git-svn-id: http://core.svn.wordpress.org/trunk@34232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-17 19:30:27 +00:00
Scott Taylor
f5edeb11d0 WP_Comment_Query: add comment__in to allowed values for $orderby.
Adds unit tests.

Fixes #33883.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 16:35:44 +00:00
Scott Taylor
72651400ba Add parent__in and parent__not_in query vars to WP_Comment_Query.
Adds unit tests.

Fixes #33882.

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


git-svn-id: http://core.svn.wordpress.org/trunk@34169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 16:23:39 +00:00
Drew Jaynes
a71ee9a0ea Docs: Add a missing file header for wp-includes/class-wp-comment-query.php, introduced in [33750].
Also clarifies the class DocBlock summary and tags for `WP_Comment_Query`.

See #33413. See #33701.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-04 01:38:24 +00:00
Scott Taylor
e73ee5ac98 Introduce WP_Comment class to model/strongly-type rows from the comments database table. Inclusion of this class is a pre-req for some more general comment cleanup and sanity.
* Takes inspiration from `WP_Post` and adds sanity to comment caching. 
* Clarifies when the current global value for `$comment` is returned. The current implementation in `get_comment()` introduces side effects and an occasion stale global value for `$comment` when comment caches are cleaned.
* Strongly-types `@param` docs
* This class is marked `final` for now

Props wonderboymusic, nacin.

See #32619.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-03 18:17:24 +00:00
Scott Taylor
f07ab12359 Comments: move WP_Comment_Query into its own file. comment.php loads the new files, so this is 100% BC if someone is loading comment.php directly. New files created using svn cp.
Creates: 
`class-wp-comment-query.php` 
`comment-functions.php` 

`comment.php` contains only top-level code. Class file only contains the class. Functions file only contains functions.

See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-26 04:27:21 +00:00