mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Revisions: optimize performance when post has large number of revisions.
Improve speed and reduce the memory footprint when loading posts with many revisions. * Use a direct query in `wp_get_post_autosave` to avoid loading all revisions. * Query for IDs vs full objects in `register_and_do_post_meta_boxes`. Props pdfernhout, johnnyb, miqrogroove, ocean90, senatorman, DBrumbaugh10Up, martijn-van-der-kooij, pavelevap, mackensen, mikeyarce, whyisjake. Fixes #34560. git-svn-id: https://develop.svn.wordpress.org/trunk@48422 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -472,7 +472,7 @@ class Tests_Ajax_CustomizeManager extends WP_Ajax_UnitTestCase {
|
||||
$this->assertTrue( $this->_last_response_parsed['success'] );
|
||||
$this->assertEquals( 'draft', $this->_last_response_parsed['data']['changeset_status'] );
|
||||
$autosave_revision = wp_get_post_autosave( $post_id );
|
||||
$this->assertInstanceOf( 'WP_Post', $autosave_revision );
|
||||
$this->assertInstanceOf( 'stdClass', $autosave_revision );
|
||||
|
||||
$this->assertContains( 'New Site Title', get_post( $post_id )->post_content );
|
||||
$this->assertContains( 'Autosaved Site Title', $autosave_revision->post_content );
|
||||
@@ -699,7 +699,7 @@ class Tests_Ajax_CustomizeManager extends WP_Ajax_UnitTestCase {
|
||||
);
|
||||
$this->assertNotWPError( $r );
|
||||
$autosave_revision = wp_get_post_autosave( $wp_customize->changeset_post_id() );
|
||||
$this->assertInstanceOf( 'WP_Post', $autosave_revision );
|
||||
$this->assertInstanceOf( 'stdClass', $autosave_revision );
|
||||
$this->assertContains( 'Foo', get_post( $wp_customize->changeset_post_id() )->post_content );
|
||||
$this->assertContains( 'Bar', $autosave_revision->post_content );
|
||||
|
||||
|
||||
@@ -1891,7 +1891,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
|
||||
|
||||
// Verify that autosave happened.
|
||||
$autosave_revision = wp_get_post_autosave( $changeset_post_id, get_current_user_id() );
|
||||
$this->assertInstanceOf( 'WP_Post', $autosave_revision );
|
||||
$this->assertInstanceOf( 'stdClass', $autosave_revision );
|
||||
$this->assertContains( 'Draft Title', get_post( $changeset_post_id )->post_content );
|
||||
$this->assertContains( 'Autosave Title', $autosave_revision->post_content );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user