Revisions: remove the new _wp_last_revision_matches_current_post(), can be replaced by a simple revisions version check. Fixes #23913

git-svn-id: http://core.svn.wordpress.org/trunk@23885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2013-04-02 19:39:48 +00:00
parent 6806d48a90
commit 51826e4cde
2 changed files with 1 additions and 44 deletions

View File

@ -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 )

View File

@ -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