WordPress/wp-admin/includes
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
..
admin-filters.php Move media hooks out of `admin-filters.php` as sometimes editors are used on the front end. 2015-08-06 20:40:26 +00:00
admin.php Move `WP_Screen` to its own file. 2015-09-15 04:08:24 +00:00
ajax-actions.php Comments: update Comment counts dynamically in the Right Now widget based on moderation actions in the Activity widget. 2015-09-24 15:53:25 +00:00
bookmark.php Provide more helpful feedback than just "Cheatin' uh?" for permission errors in `wp-admin/includes/bookmark.php`. 2015-09-03 08:59:24 +00:00
class-ftp-pure.php Updates: FTP/PemFTP Library: Remove the usage of deprecated regular expression functions (ereg replaced by PCRE). 2015-09-18 08:20:27 +00:00
class-ftp-sockets.php Updates: FTP/PemFTP Library: Remove the usage of deprecated regular expression functions (ereg replaced by PCRE). 2015-09-18 08:20:27 +00:00
class-ftp.php Updates: FTP: Add a missing PCRE modifer in [34281]. 2015-09-18 08:23:25 +00:00
class-pclzip.php Deprecate php4 style constructors 2015-06-28 15:27:24 +00:00
class-walker-category-checklist.php Docs: Clarify the file header summary for wp-admin/includes/class-walker-category-checklist.php, introduced in [34241]. 2015-09-22 14:33:48 +00:00
class-walker-nav-menu-checklist.php Move the admin Nav Menu Walker subclasses into their own files. Load in `nav-menu.php` to remain BC. 2015-09-15 04:02:25 +00:00
class-walker-nav-menu-edit.php Move the admin Nav Menu Walker subclasses into their own files. Load in `nav-menu.php` to remain BC. 2015-09-15 04:02:25 +00:00
class-wp-comments-list-table.php Comments List Table: fix the translators comment for all count after [34506]. 2015-09-24 18:40:24 +00:00
class-wp-filesystem-base.php Add `@access` docs to `class-wp-filesystem-*` files. 2015-09-10 01:21:24 +00:00
class-wp-filesystem-direct.php Add `@access` docs to `class-wp-filesystem-*` files. 2015-09-10 01:21:24 +00:00
class-wp-filesystem-ftpext.php Docs: Add a summary, version, and parameter and return descriptions to the DocBlock for `WP_Filesystem_FTPext::get_contents()`. 2015-09-24 14:11:26 +00:00
class-wp-filesystem-ftpsockets.php Docs: Add a summary, version, and parameter and return descriptions to the DocBlock for `WP_Filesystem_ftpsockets::get_contents()`. 2015-09-24 14:22:24 +00:00
class-wp-filesystem-ssh2.php Add `@access` docs to `class-wp-filesystem-*` files. 2015-09-10 01:21:24 +00:00
class-wp-importer.php Remove unnecessary feedback message from `WP_Importer::is_user_over_quota()`. 2015-06-30 20:32:25 +00:00
class-wp-internal-pointers.php Docs: Clarify the file header summary for wp-admin/includes/class-wp-internal-pointers.php, introduced in [34241]. 2015-09-22 14:35:25 +00:00
class-wp-links-list-table.php List Tables: 2015-07-14 17:47:24 +00:00
class-wp-list-table.php List Tables: add JS code to dynamically toggle the `disabled` attribute of the Bulk Actions dropdown and Apply button. 2015-09-24 01:07:24 +00:00
class-wp-media-list-table.php Remove some unused globals and/or their docs. 2015-09-22 20:27:25 +00:00
class-wp-ms-sites-list-table.php List Tables: when comparing string literals (non-numeric in nature) against vars, strict comparison can/should be used. 2015-09-22 06:06:25 +00:00
class-wp-ms-themes-list-table.php List Tables: when comparing string literals (non-numeric in nature) against vars, strict comparison can/should be used. 2015-09-22 06:06:25 +00:00
class-wp-ms-users-list-table.php List Tables: when comparing string literals (non-numeric in nature) against vars, strict comparison can/should be used. 2015-09-22 06:06:25 +00:00
class-wp-plugin-install-list-table.php List Tables: when comparing string literals (non-numeric in nature) against vars, strict comparison can/should be used. 2015-09-22 06:06:25 +00:00
class-wp-plugins-list-table.php Implement 'Recently Active' functionality for network-wide plugins in the Network Admin. 2015-09-25 19:16:27 +00:00
class-wp-post-comments-list-table.php Docs: Clarify the file header summary for wp-admin/includes/class-wp-post-comments-list-table.php, introduced in [34223]. 2015-09-22 14:31:24 +00:00
class-wp-posts-list-table.php List Tables: when comparing string literals (non-numeric in nature) against vars, strict comparison can/should be used. 2015-09-22 06:06:25 +00:00
class-wp-press-this.php Round 2 of: We should use ellipses … / … instead of three dots/periods ... e.g Loading… not Loading... 2015-09-09 04:39:25 +00:00
class-wp-screen.php Docs: Clarify the class DocBlock summary for `WP_Screen`. 2015-09-22 14:28:24 +00:00
class-wp-site-icon.php Don't ever use the `guid` value when retrieving URLs for media, use `wp_get_attachment_url()`. Use `get_attached_file()` for path to file. 2015-09-15 02:50:25 +00:00
class-wp-terms-list-table.php List Tables: when comparing string literals (non-numeric in nature) against vars, strict comparison can/should be used. 2015-09-22 06:06:25 +00:00
class-wp-theme-install-list-table.php List Tables: when comparing string literals (non-numeric in nature) against vars, strict comparison can/should be used. 2015-09-22 06:06:25 +00:00
class-wp-themes-list-table.php Themes: Remove legacy theme preview. 2015-07-29 18:36:26 +00:00
class-wp-upgrader-skins.php Upgrader: Avoid using an HTML tag in a translation string, add translator comments. 2015-09-20 08:59:24 +00:00
class-wp-upgrader.php Introduce a `send_update_notification_email` which controls whether an update notification email is sent for background updates. This filter allows control over each of the update types (plugin, theme, translation) and compliments the `automatic_updates_send_debug_email` and `send_core_update_notification_email` filters. 2015-09-25 14:29:23 +00:00
class-wp-users-list-table.php List Tables: when comparing string literals (non-numeric in nature) against vars, strict comparison can/should be used. 2015-09-22 06:06:25 +00:00
comment.php Allow `comment_exists()` to match based on GMT date. 2015-09-23 18:16:26 +00:00
continents-cities.php
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
dashboard.php Comments: update Comment counts dynamically in the Right Now widget based on moderation actions in the Activity widget. 2015-09-24 15:53:25 +00:00
deprecated.php Pass `false` as the 2nd argument to `class_exists()` to disable autoloading and to not cause problems for those who define `__autoload()`. 2015-09-20 03:52:25 +00:00
edit-tag-messages.php Don't redirect to the Term list table after submitting the form on the Edit Term page. 2015-09-15 15:59:42 +00:00
export.php Export: Add late-escaping to the contents of several nodes to avoid creating invalid XML and XML parse errors. 2015-09-19 18:53:25 +00:00
file.php Pass `false` as the 2nd argument to `class_exists()` to disable autoloading and to not cause problems for those who define `__autoload()`. 2015-09-20 03:52:25 +00:00
image-edit.php Docs: Put "it's" in its place (again). 2015-09-16 12:46:28 +00:00
image.php After [34374], ensure that `$iptc` is defined. 2015-09-22 04:49:24 +00:00
import.php Add (more) missing doc blocks to `wp-admin/includes/*`. 2015-05-29 21:17:27 +00:00
list-table.php Comments: Fix a fatal error in Comments meta box after [34223]. 2015-09-16 11:37:25 +00:00
media.php Pass `false` as the 2nd argument to `class_exists()` to disable autoloading and to not cause problems for those who define `__autoload()`. 2015-09-20 03:52:25 +00:00
menu.php Don't loosely compare functions that return `bool` against a literal `bool`. 2015-06-12 17:19:27 +00:00
meta-boxes.php Meta Boxes: In `post_categories_meta_box()`, convert some spaces to tabs. 2015-09-21 15:18:26 +00:00
misc.php Pass `false` as the 2nd argument to `class_exists()` to disable autoloading and to not cause problems for those who define `__autoload()`. 2015-09-20 03:52:25 +00:00
ms-admin-filters.php Cleanup `(ms-)?admin-filters.php` 2015-06-19 21:18:25 +00:00
ms-deprecated.php Docs: Standardize `@deprecated` tag formatting for deprecated functions in wp-admin/includes/ms-deprecated.php. 2015-08-20 22:26:24 +00:00
ms.php Require numeric IDs in user deletion functions. 2015-09-11 02:25:23 +00:00
nav-menu.php Docs: Add a file header to wp-admin/includes/nav-menus.php. 2015-09-22 14:27:24 +00:00
network.php Add missing translator comment after [34292]. 2015-09-18 18:40:24 +00:00
noop.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
options.php Move ad hoc Options functions to `wp-admin/includes/options.php`: 2015-09-10 21:45:24 +00:00
plugin-install.php Avoid a PHP notice if the `last_updated` property isn't present in a plugin's data from the Plugins API. 2015-09-23 15:10:25 +00:00
plugin.php Don't use `<code>` in translation strings in `wp-admin/includes/plugin.php`. 2015-09-18 20:29:26 +00:00
post.php The `'get_sample_permalink_html'` filter​'s second parameter can be a post ID or a post object. This is confusing. We should pass the post ID and post object separately, for consistency with `'get_sample_permalink'` filter added in [34309]. 2015-09-20 03:26:25 +00:00
revision.php Revisions: add a `'wp_prepare_revision_for_js'` filter. 2015-09-25 14:04:24 +00:00
schema.php Force comment pagination on single posts. 2015-09-25 20:40:25 +00:00
screen.php Move `WP_Screen` to its own file. 2015-09-15 04:08:24 +00:00
taxonomy.php Correct a parameter name in the docs for `wp_insert_category()`. 2015-07-13 12:59:25 +00:00
template-functions.php Docs: Clarify the file header summary for wp-admin/includes/template-functions.php, introduced in [34241]. 2015-09-22 14:37:25 +00:00
template.php `wp-admin/includes/template.php` is now a loader for 3 files made via `svn cp`: 2015-09-16 15:35:23 +00:00
theme-install.php Add doc blocks to functions that are missing them. 2015-05-31 03:18:25 +00:00
theme.php Bump H3 headings to H2 on Themes screen for better accessibility. 2015-08-31 03:51:21 +00:00
translation-install.php Add `@global` annotations to (the rest of the?) `wp-admin/*` files. 2015-05-29 02:06:31 +00:00
update-core.php List Tables: add JS code to dynamically toggle the `disabled` attribute of the Bulk Actions dropdown and Apply button. 2015-09-24 01:07:24 +00:00
update.php Don't use HTML tags in translation strings in `wp-admin/includes/update.php`. 2015-09-18 18:31:25 +00:00
upgrade.php Introduce metadata for taxonomy terms. 2015-09-25 03:59:27 +00:00
user.php Pinking shears. 2015-09-25 04:44:25 +00:00
widgets.php Move `wp_widgets_access_body_class()` (a hook callback) from `wp-admin/widgets.php` to `wp-admin/includes/widgets.php`. 2015-09-10 21:22:23 +00:00