From 8a8d7369d7ce8158240385f7276e79a179c752ba Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 2 Apr 2013 19:39:48 +0000 Subject: [PATCH] Revisions: remove the new _wp_last_revision_matches_current_post(), can be replaced by a simple revisions version check. Fixes #23913 git-svn-id: https://develop.svn.wordpress.org/trunk@23885 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post-template.php | 2 +- wp-includes/revision.php | 43 ----------------------------------- 2 files changed, 1 insertion(+), 44 deletions(-) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 41b3096491..ff0e1cbddb 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -1424,7 +1424,7 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) { // 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_last_revision_matches_current_post( $post_id ); + $parent_included = _wp_get_post_revision_version( reset( $revisions ) ) > 0; if ( $parent_included && ! $parent ) array_shift( $revisions ); elseif ( ! $parent_included && $parent ) diff --git a/wp-includes/revision.php b/wp-includes/revision.php index 0944d1e59b..2f46abdab5 100644 --- a/wp-includes/revision.php +++ b/wp-includes/revision.php @@ -657,49 +657,6 @@ function _wp_upgrade_revisions_of_post( $post ) { return true; } -/** - * Determines if the specified post's most recent revision matches the post (by checking post_modified). - * - * @package WordPress - * @subpackage Post_Revisions - * @since 3.6.0 - * - * @param int|object $post Post ID or post object. - * @return bool false if not a match, otherwise true. - */ -function _wp_last_revision_matches_current_post( $post ) { - if ( ! $post = get_post( $post ) ) - return false; - - if ( ! $revisions = wp_get_post_revisions( $post->ID ) ) - return false; - - foreach ( $revisions as $revision ) { - if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) { - $last_revision = $revision; - break; - } - } - - // No revisions yet, only autosaves - if ( ! isset( $last_revision ) ) - return false; - - $post_has_changed = false; - if ( $last_revision->post_modified == $post->post_modified ) { - foreach ( array_keys( _wp_post_revision_fields() ) as $field ) { - if ( normalize_whitespace( $post->$field ) != normalize_whitespace( $last_revision->$field ) ) { - $post_has_changed = true; - break; - } - } - } else { - return false; - } - - return ! $post_has_changed; -} - /** * Displays a human readable HTML representation of the difference between two strings. * similar to wp_text_diff, but tracks and returns could of lines added and removed