WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 4 months ago

Last modified 3 months ago

#25233 closed enhancement (wontfix)

Revisions metabox improvements

Reported by: jkudish Owned by: adamsilverstein
Milestone: Priority: normal
Severity: normal Version:
Component: Revisions Keywords: needs-patch
Focuses: Cc:

Description

The revisions metabox suffers from performance degradation when unlimited revisions are allowed and a large amount of revisions (e.g. 600+) is achieved on a post.

Symptoms:

  • Slow wp-admin page loads
  • Out of memory errors and 500 errors.

This seems to be mainly due to:

  • All revisions are loaded at once when a post is loaded in wp-admin
  • For each revision, the entire $post object is loaded, when only a few pieces of information are needed
  • The queries in get_children() are not cached

Proposed solution:

  • Rewrite the revisions meta box to load the revisions via ajax instead of with the initial page load, possibly with pagination or some kind of infinite scroll.
  • Only load the information required and not the entire $post object for each revision.
  • Cache the queries involved.

Possible bottlenecks:

  • The get_children() and wp_get_post_revisions() functions are used in a bunch of different places, so it might be difficult to bake in compatibility for everything. Might be easier to create some new functions for the metabox specifically.
  • Currently WordPress loads all the revsions in order to possibly upgrade them to the 3.6 versioning of revisions. It does so on every post loaded in wp-admin. It might make sense to move this to an upgrade routine or somewhere else as it adds to the performance degradation.

If this sounds like a good approach I'd be happy to work on a patch.

Change History (7)

#1 @jkudish
6 years ago

  • Type changed from defect (bug) to enhancement

#2 @johnbillion
6 years ago

Related: #25123 where it's been suggested that the revisions meta box is removed altogether.

#3 @adamsilverstein
6 years ago

  • Cc adamsilverstein@… added

Related: #24958

#4 @adamsilverstein
4 years ago

  • Owner set to adamsilverstein
  • Status changed from new to assigned

The plan is now to remove the revisions meta box, plugins can easily add similar functionality (see plugin linked in #25123). The revisions page itself can likely use some optimization (especially with many/large revisions. In any case, there is no reason to burden the post editing page!

Even setting the publish meta box X Revisions count (https://core.trac.wordpress.org/browser/tags/4.1/src/wp-admin/edit-form-advanced.php#L153) gets all revisions and can be costly: that should get fixed as well (i tried fields=> ids to no avail).

The version upgrade check, this call should only be loading in one revision: https://core.trac.wordpress.org/browser/tags/4.1/src/wp-admin/includes/post.php#L210

#5 @pdfernhout
3 years ago

Issue #34560 overlaps this one, but is about out-of-memory server errors resulting from using the edit screen on a large post with many revisions. A patch has been created there by @adamsilverstein that improves that situation, and aspects of that patch might help address this issue.

#6 @iseulde
4 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from assigned to closed

This ticket has not seen any activity in over *two* years, so I'm closing it as "wontfix".

The ticket may lack decisiveness, may have become irrelevant, or may not have gathered enough interest.

If you think this ticket does deserve some attention again, feel free to reopen.

For bugs, it would be great if you could provide updated steps to reproduce against the latest version of WordPress (5.0.2 at the time of writing). Remember images or a video can be superior to explain a problem. At the very least, quickly test again to make sure the bug still exists.

If it’s an enhancement or feature, some extra motivation may help.

Thank you for your contributions to WordPress! <3

#7 @adamsilverstein
3 months ago

Agreed... leaving closed: if this is still relevant with the new block editor, we can open a new issue to work on it.

Note: See TracTickets for help on using tickets.