From 87464289c387757943d07e8474d8dab61ba7b6f2 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 25 Jul 2022 19:30:09 +0000 Subject: [PATCH] Revisions: Update the "last revision" wording to "latest revision" in various files. This aims to reduce ambiguity about what exactly is the "first" or "last" revision, and bring more consistency with similar wording elsewhere in core, e.g. latest posts, latest comments, etc. This affects: * `wp_save_post_revision()` * `wp_prepare_revisions_for_js()` * `WP_Customize_Manager::filter_revision_post_has_changed()` Follow-up to [53759], [53769], [53778]. Props peterwilsoncc. Fixes #55857. Built from https://develop.svn.wordpress.org/trunk@53779 git-svn-id: http://core.svn.wordpress.org/trunk@53338 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/revision.php | 2 +- wp-includes/class-wp-customize-manager.php | 6 +++--- wp-includes/revision.php | 16 ++++++++-------- wp-includes/version.php | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/wp-admin/includes/revision.php b/wp-admin/includes/revision.php index 2eb83cb75c..a91fc54650 100644 --- a/wp-admin/includes/revision.php +++ b/wp-admin/includes/revision.php @@ -300,7 +300,7 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null } /* - * If a post has been saved since the last revision (no revisioned fields + * If a post has been saved since the latest revision (no revisioned fields * were changed), we may not have a "current" revision. Mark the latest * revision as "current". */ diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 7809608e69..3b3259c573 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -3427,12 +3427,12 @@ final class WP_Customize_Manager { * @since 4.7.0 * * @param bool $post_has_changed Whether the post has changed. - * @param WP_Post $last_revision The last revision post object. + * @param WP_Post $latest_revision The latest revision post object. * @param WP_Post $post The post object. * @return bool Whether a revision should be made. */ - public function _filter_revision_post_has_changed( $post_has_changed, $last_revision, $post ) { - unset( $last_revision ); + public function _filter_revision_post_has_changed( $post_has_changed, $latest_revision, $post ) { + unset( $latest_revision ); if ( 'customize_changeset' === $post->post_type ) { $post_has_changed = $this->store_changeset_revision; } diff --git a/wp-includes/revision.php b/wp-includes/revision.php index f1a888f6dd..0870b837c2 100644 --- a/wp-includes/revision.php +++ b/wp-includes/revision.php @@ -136,16 +136,16 @@ function wp_save_post_revision( $post_id ) { */ $revisions = wp_get_post_revisions( $post_id ); if ( $revisions ) { - // Grab the last revision, but not an autosave. + // Grab the latest revision, but not an autosave. foreach ( $revisions as $revision ) { if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) { - $last_revision = $revision; + $latest_revision = $revision; break; } } /** - * Filters whether the post has changed since the last revision. + * Filters whether the post has changed since the latest revision. * * By default a revision is saved only if one of the revisioned fields has changed. * This filter can override that so a revision is saved even if nothing has changed. @@ -154,14 +154,14 @@ function wp_save_post_revision( $post_id ) { * * @param bool $check_for_changes Whether to check for changes before saving a new revision. * Default true. - * @param WP_Post $last_revision The last revision post object. + * @param WP_Post $latest_revision The latest revision post object. * @param WP_Post $post The post object. */ - if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $last_revision, $post ) ) { + if ( isset( $latest_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $latest_revision, $post ) ) { $post_has_changed = false; foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) { - if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $last_revision->$field ) ) { + if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $latest_revision->$field ) ) { $post_has_changed = true; break; } @@ -176,10 +176,10 @@ function wp_save_post_revision( $post_id ) { * @since 4.1.0 * * @param bool $post_has_changed Whether the post has changed. - * @param WP_Post $last_revision The last revision post object. + * @param WP_Post $latest_revision The latest revision post object. * @param WP_Post $post The post object. */ - $post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $last_revision, $post ); + $post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $latest_revision, $post ); // Don't save revision if post unchanged. if ( ! $post_has_changed ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 1bb7306938..009207e64d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-53778'; +$wp_version = '6.1-alpha-53779'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.