WordPress/wp-admin
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
..
css Widgets: use `input[type="number"]` for the `number` prop in the Recent Posts and Recent Comments widget forms. 2015-09-24 19:53:26 +00:00
images Squish that .png a bit more. See [32994]. 2015-06-30 22:04:25 +00:00
includes Force comment pagination on single posts. 2015-09-25 20:40:25 +00:00
js Customizer: Fix usage of `jQuery.contains()` allowing `active` state changes to again animate control visibility. 2015-09-25 19:54:50 +00:00
maint Improve the tone of key/salts recommendation message. 2015-07-01 15:39:26 +00:00
network Multisite: as a precaution, make `wp-json` a reserved subdirectory name. 2015-09-22 04:21:25 +00:00
user Ensure the requires for the admin bootstrap are documented in all wp-admin/user/ files. 2014-11-04 16:32:22 +00:00
about.php About: Remove period from placeholder. 2015-09-11 19:27:24 +00:00
admin-ajax.php Profile: when clicking "Cancel" after clicking "Generate Password", request and generate a new password to present to the user. 2015-09-18 20:14:24 +00:00
admin-footer.php Add `@global` annotations for `wp-admin/*`. 2015-05-28 21:41:30 +00:00
admin-functions.php
admin-header.php Correct the title used on the user dashboard. 2015-06-24 00:37:28 +00:00
admin-post.php Superglobals: Revert [34059] until further notice. 2015-09-17 12:33:26 +00:00
admin.php Superglobals: Revert [34059] until further notice. 2015-09-17 12:33:26 +00:00
async-upload.php Superglobals: Revert [34059] until further notice. 2015-09-17 12:33:26 +00:00
comment.php Include placeholders in translator comments. 2015-09-18 18:58:24 +00:00
credits.php Move ad hoc functions from `wp-admin/credits.php` to `wp-admin/includes/credits.php`, which is only included by the former. 2015-09-11 04:55:26 +00:00
custom-background.php Docs: Add a summary, version, and `@access` tag to the property DocBlock for `Custom_Background->updated`. 2015-09-24 13:34:24 +00:00
custom-header.php Docs: Add a summary, version, and `@access` tag to the property DocBlock for `Custom_Image_Header->updated`. 2015-09-24 13:39:25 +00:00
customize.php Customize: Reduce peak memory usage by JSON-encoding settings and controls individually. 2015-09-17 19:42:26 +00:00
edit-comments.php Comments: add `date` column to `WP_Comments_List_Table` to allow sorting and to break out the date/time from the comment content column. 2015-09-24 17:27:26 +00:00
edit-form-advanced.php Shortlinks: Hide the Get Shortlink button by default. 2015-09-25 19:54:25 +00:00
edit-form-comment.php Add missing translator comment after [34295]. 2015-09-18 18:50:24 +00:00
edit-link-form.php Use a less element-specific class name for links within page titles. 2015-07-03 16:42:24 +00:00
edit-tag-form.php When applying the `'editable_slug'` filter, add a second param that provides more context. 2015-09-19 05:49:24 +00:00
edit-tags.php Remove the ability to view the term editing screen for taxonomies with `show_ui` set to `false`. It is unexpected and unintended behaviour that this is allowed. 2015-09-20 17:11:25 +00:00
edit.php Remove the ability to view the post listing screen and post editing screen for post types with `show_ui` set to `false`. It is unexpected and unintended behaviour that this is allowed. 2015-09-15 10:27:29 +00:00
export.php Export: allow Media to exported separately from other types. 2015-09-19 16:47:25 +00:00
freedoms.php About: Third pass at 4.3 about page: 2015-08-13 22:11:35 +00:00
import.php Proper heading for admin screens. 2015-06-27 15:41:25 +00:00
index.php Replace some hyphens with `—`s in admin help tabs. 2015-08-19 04:53:25 +00:00
install-helper.php Add missing doc blocks to `wp-admin/includes/*`. 2015-05-29 20:17:26 +00:00
install.php Implement some more uses of `wp_login_url()` in places where wp-login.php is hard-coded. 2015-09-20 16:54:24 +00:00
link-add.php
link-manager.php Use a less element-specific class name for links within page titles. 2015-07-03 16:42:24 +00:00
link-parse-opml.php Add `@global` annotations for `wp-admin/*`. 2015-05-28 21:41:30 +00:00
link.php
load-scripts.php Create a new file, `wp-admin/includes/noop.php`, which loads all of the noop functions for `load-script|styles.php` and is only loaded by those files. DRYs in the process. 2015-09-11 05:04:23 +00:00
load-styles.php Create a new file, `wp-admin/includes/noop.php`, which loads all of the noop functions for `load-script|styles.php` and is only loaded by those files. DRYs in the process. 2015-09-11 05:04:23 +00:00
media-new.php `media-new.php`, when using the browser uploader, if the result of uploading is a `WP_Error` - `wp_die()` with the error, instead of redirecting with a generic error. 2015-09-10 17:18:24 +00:00
media-upload.php Provide more helful feedback than just "Cheatin' uh?" for permission errors in `wp-admin/media-upload.php`. 2015-09-02 16:21:21 +00:00
media.php Use a less element-specific class name for links within page titles. 2015-07-03 16:42:24 +00:00
menu-header.php Admin menu: improve accessibility when collapsed. 2015-06-25 19:33:26 +00:00
menu.php After [33723], ensure that `$i` is properly set before looping. 2015-09-02 18:48:22 +00:00
moderation.php
ms-admin.php
ms-delete-site.php Trim trailing space from string in site delete confirmation 2015-07-01 16:31:25 +00:00
ms-edit.php
ms-options.php
ms-sites.php
ms-themes.php
ms-upgrade-network.php
ms-users.php
my-sites.php Merge two similar strings about insufficient permissions. 2015-07-27 13:25:25 +00:00
nav-menus.php Provide more helpful feedback than just "Cheatin' uh?" for permission errors in `wp-admin/nav-menus.php`. 2015-09-02 18:21:21 +00:00
network.php Network Setup: don't use `<code>` in translation strings in `wp-admin/network` files. 2015-09-18 18:18:27 +00:00
options-discussion.php Force comment pagination on single posts. 2015-09-25 20:40:25 +00:00
options-general.php Add missing translator comments after [34294]. 2015-09-18 18:46:24 +00:00
options-head.php
options-media.php Bump H3 headings to H2 on the Media Settings screen for better accessibility. 2015-09-05 20:12:25 +00:00
options-permalink.php Move ad hoc Options functions to `wp-admin/includes/options.php`: 2015-09-10 21:45:24 +00:00
options-reading.php Move ad hoc Options functions to `wp-admin/includes/options.php`: 2015-09-10 21:45:24 +00:00
options-writing.php Bump H3 headings to H2 on the Writing Settings screen for better accessibility. 2015-09-13 16:48:26 +00:00
options.php Force comment pagination on single posts. 2015-09-25 20:40:25 +00:00
plugin-editor.php Implement 'Recently Active' functionality for network-wide plugins in the Network Admin. 2015-09-25 19:16:27 +00:00
plugin-install.php Use a less element-specific class name for links within page titles. 2015-07-03 16:42:24 +00:00
plugins.php Implement 'Recently Active' functionality for network-wide plugins in the Network Admin. 2015-09-25 19:16:27 +00:00
post-new.php Provide more helpful feedback than just "Cheatin' uh?" for permission errors in `wp-admin/post-new.php`. 2015-09-02 18:36:22 +00:00
post.php Remove the ability to view the post listing screen and post editing screen for post types with `show_ui` set to `false`. It is unexpected and unintended behaviour that this is allowed. 2015-09-15 10:27:29 +00:00
press-this.php Provide more helpful feedback than just "Cheatin' uh?" for permission errors in `wp-admin/press-this.php`. 2015-09-02 18:38:21 +00:00
profile.php
revision.php Revisions screen: change language from "Return to post editor" to "Return to editor" - more generic for usage by custom post types. 2015-09-09 03:23:23 +00:00
setup-config.php `foreach` is a statement, not a function. 2015-08-25 20:28:22 +00:00
theme-editor.php Bump H3 headings to H2 on the Theme Editor screen for better accessibility. 2015-09-12 00:00:24 +00:00
theme-install.php Themes: Don't use HTML entities for placeholders. 2015-09-12 19:48:24 +00:00
themes.php Notices: Add styles for use against white backgrounds. 2015-09-21 15:26:25 +00:00
tools.php Bump H3 headings to H2 on Tools screen for better accessibility. 2015-08-31 03:32:21 +00:00
update-core.php Update Core: In `list_plugin_updates()`, when listing plugin updates related to `$core_update_version`, don't skip the check for `$info->tested`. 2015-09-19 16:10:26 +00:00
update.php Superglobals: Revert [34059] until further notice. 2015-09-17 12:33:26 +00:00
upgrade-functions.php
upgrade.php Add `@global` annotations for `wp-admin/*`. 2015-05-28 21:41:30 +00:00
upload.php Media List Table: remove the counts from the "views" portion of the toolbar, which are inconsistent with grid view. Also reduces complexity and removes potentially expensive count query. 2015-09-17 02:30:26 +00:00
user-edit.php Move 2 ad hoc user admin functions: 2015-09-10 21:33:33 +00:00
user-new.php Superglobals: Revert [34059] until further notice. 2015-09-17 12:33:26 +00:00
users.php Docs: The User API is singular. 2015-09-22 12:31:26 +00:00
widgets.php Docs: The Widget API is singular. 2015-09-22 12:28:27 +00:00