WordPress.org

Make WordPress Core

Changeset 25719


Ignore:
Timestamp:
10/07/2013 06:34:35 PM (7 years ago)
Author:
nacin
Message:

Move the revisions upgrade handler to POST, to avoid esoteric metadata stomping.

props SergeyBiryukov.
see #25023.
for trunk.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-advanced.php

    r25616 r25719  
    115115    $revisions = wp_get_post_revisions( $post_ID );
    116116
    117     // Check if the revisions have been upgraded
    118     if ( ! empty( $revisions ) && _wp_get_post_revision_version( end( $revisions ) ) < 1 )
    119         _wp_upgrade_revisions_of_post( $post, $revisions );
    120 
    121117    // We should aim to show the revisions metabox only when there are revisions.
    122118    if ( count( $revisions ) > 1 ) {
  • trunk/src/wp-admin/includes/post.php

    r25697 r25719  
    177177        else
    178178            wp_die( __('You are not allowed to edit this post.' ));
     179    }
     180
     181    if ( post_type_supports( $ptype->name, 'revisions' ) ) {
     182        $revisions = wp_get_post_revisions( $post_ID, array( 'order' => 'ASC', 'posts_per_page' => 1 ) );
     183        $revision = current( $revisions );
     184
     185        // Check if the revisions have been upgraded
     186        if ( $revisions && _wp_get_post_revision_version( $revision ) < 1 )
     187            _wp_upgrade_revisions_of_post( $post, wp_get_post_revisions( $post_ID ) );
    179188    }
    180189
Note: See TracChangeset for help on using the changeset viewer.