Ticket #7392: 7392-3.diff
File 7392-3.diff, 2.5 KB (added by , 12 years ago) |
---|
-
wp-includes/default-filters.php
249 249 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 ); 250 250 add_action( 'plugins_loaded', 'wp_maybe_load_embeds', 0 ); 251 251 add_action( 'shutdown', 'wp_ob_end_flush_all', 1 ); 252 add_action( 'pre_post_update', 'wp_save_post_revision' 252 add_action( 'pre_post_update', 'wp_save_post_revision', 10, 2 ); 253 253 add_action( 'publish_post', '_publish_post_hook', 5, 1 ); 254 254 add_action( 'transition_post_status', '_transition_post_status', 5, 3 ); 255 255 add_action( 'transition_post_status', '_update_term_count_on_transition_post_status', 10, 3 ); -
wp-includes/post.php
2866 2866 $where = array( 'ID' => $post_ID ); 2867 2867 2868 2868 if ( $update ) { 2869 do_action( 'pre_post_update', $post_ID );2869 do_action( 'pre_post_update', $post_ID, $data ); 2870 2870 if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) { 2871 2871 if ( $wp_error ) 2872 2872 return new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error); … … 4937 4937 * @param int $post_id The ID of the post to save as a revision. 4938 4938 * @return mixed Null or 0 if error, new revision ID, if success. 4939 4939 */ 4940 function wp_save_post_revision( $post_id ) {4940 function wp_save_post_revision( $post_id, $new_data = null ) { 4941 4941 // We do autosaves manually with wp_create_post_autosave() 4942 4942 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 4943 4943 return; … … 4955 4955 if ( !post_type_supports($post['post_type'], 'revisions') ) 4956 4956 return; 4957 4957 4958 // if new data is supplied, check that it is different from last saved revision 4959 if( is_array( $new_data ) ) { 4960 $post_has_changed = false; 4961 foreach( array_keys( _wp_post_revision_fields() ) as $field ) { 4962 if( normalize_whitespace( $new_data[ $field ] ) != normalize_whitespace( $post[ $field ] ) ) { 4963 $post_has_changed = true; 4964 break; 4965 } 4966 } 4967 //don't save revision if post unchanged 4968 if( ! $post_has_changed ) 4969 return; 4970 } 4971 4958 4972 $return = _wp_put_post_revision( $post ); 4959 4973 4960 4974 // WP_POST_REVISIONS = true (default), -1