Make WordPress Core


Ignore:
Timestamp:
07/18/2013 02:10:33 PM (11 years ago)
Author:
nacin
Message:

If two revisions were created at the same time, mark the one with the greater ID as current. Also avoid flagging autosaves as current. fixes #24782.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/revision.php

    r24726 r24730  
    117117        }
    118118
     119        $autosave = wp_is_post_autosave( $revision );
     120        $current = ! $autosave && $revision->post_modified_gmt === $post->post_modified_gmt;
     121        if ( $current && ! empty( $current_id ) ) {
     122            if ( $current_id < $revision->ID ) {
     123                $revisions[ $current_id ]['current'] = false;
     124                $current_id = $revision->ID;
     125            } else {
     126                $current = false;
     127            }
     128        } elseif ( $current ) {
     129            $current_id = $revision->ID;
     130        }
     131
    119132        $revisions[ $revision->ID ] = array(
    120133            'id'         => $revision->ID,
     
    124137            'dateShort'  => date_i18n( _x( 'j M @ G:i', 'revision date short format' ), $modified ),
    125138            'timeAgo'    => sprintf( __( '%s ago' ), human_time_diff( $modified_gmt, $now_gmt ) ),
    126             'autosave'   => wp_is_post_autosave( $revision ),
    127             'current'    => $revision->post_modified_gmt === $post->post_modified_gmt,
     139            'autosave'   => $autosave,
     140            'current'    => $current,
    128141            'restoreUrl' => urldecode( $restore_link ),
    129142        );
Note: See TracChangeset for help on using the changeset viewer.