Make WordPress Core


Ignore:
Timestamp:
07/10/2020 03:12:00 PM (4 years ago)
Author:
adamsilverstein
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/ajax/CustomizeManager.php

    r48211 r48422  
    473473        $this->assertEquals( 'draft', $this->_last_response_parsed['data']['changeset_status'] );
    474474        $autosave_revision = wp_get_post_autosave( $post_id );
    475         $this->assertInstanceOf( 'WP_Post', $autosave_revision );
     475        $this->assertInstanceOf( 'stdClass', $autosave_revision );
    476476
    477477        $this->assertContains( 'New Site Title', get_post( $post_id )->post_content );
     
    700700        $this->assertNotWPError( $r );
    701701        $autosave_revision = wp_get_post_autosave( $wp_customize->changeset_post_id() );
    702         $this->assertInstanceOf( 'WP_Post', $autosave_revision );
     702        $this->assertInstanceOf( 'stdClass', $autosave_revision );
    703703        $this->assertContains( 'Foo', get_post( $wp_customize->changeset_post_id() )->post_content );
    704704        $this->assertContains( 'Bar', $autosave_revision->post_content );
Note: See TracChangeset for help on using the changeset viewer.