From 239ccffe14a16de448389ba6745f4604330fce85 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 12 Apr 2013 19:29:21 +0000 Subject: [PATCH] Revisions: compare revisions by date in wp_ajax_revisions_data(), deprecate the $parent arg in wp_list_post_revisions() as now revisions always include a copy of the current post, props adamsilverstein, see #23901 git-svn-id: https://develop.svn.wordpress.org/trunk@23975 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/ajax-actions.php | 2 +- wp-includes/post-template.php | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 9cc67867ba..43feb6f753 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -2129,7 +2129,7 @@ function wp_ajax_revisions_data() { $left_revision = get_post( $post_id ); // make sure the right revision is the most recent - if ( $compare_two_mode && $right_revision->ID < $left_revision->ID ) { + if ( $compare_two_mode && $right_revision->post_date < $left_revision->post_date ) { $temp = $left_revision; $left_revision = $right_revision; $right_revision = $temp; diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index ff0e1cbddb..23173997f7 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -1387,6 +1387,8 @@ function wp_post_revision_title_expanded( $revision, $link = true ) { * * Second argument controls parameters: * (bool) parent : include the parent (the "Current Revision") in the list. + * Deprecated (ignored), since 3.6 the revisions always include + * a copy of the current post. * (string) format : 'list' or 'form-table'. 'list' outputs UL, 'form-table' * outputs TABLE with UI. * (int) right : what revision is currently being viewed - used in @@ -1413,7 +1415,7 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) { if ( !$post = get_post( $post_id ) ) return; - $defaults = array( 'parent' => false, 'right' => false, 'left' => false, 'format' => 'list', 'type' => 'all' ); + $defaults = array( 'right' => false, 'left' => false, 'format' => 'list', 'type' => 'all' ); extract( wp_parse_args( $args, $defaults ), EXTR_SKIP ); if ( !$revisions = wp_get_post_revisions( $post->ID ) ) @@ -1422,14 +1424,6 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) { /* translators: post revision: 1: when, 2: author name */ $titlef = _x( '%1$s', 'post revision' ); - // Since 3.6 revisions include a copy of the current post data as a revision. - // The following removes that revision when $parent == false - $parent_included = _wp_get_post_revision_version( reset( $revisions ) ) > 0; - if ( $parent_included && ! $parent ) - array_shift( $revisions ); - elseif ( ! $parent_included && $parent ) - array_unshift( $revisions, $post ); - $rows = $right_checked = ''; $class = false; $can_edit_post = current_user_can( 'edit_post', $post->ID );