WordPress.org

Make WordPress Core


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.