Ticket #7392: 7392.diff
File 7392.diff, 2.3 KB (added by , 14 years ago) |
---|
-
wp-includes/default-filters.php
240 240 add_action( 'plugins_loaded', 'wp_maybe_load_widgets', 0 ); 241 241 add_action( 'plugins_loaded', 'wp_maybe_load_embeds', 0 ); 242 242 add_action( 'shutdown', 'wp_ob_end_flush_all', 1 ); 243 add_action( 'pre_post_update', 'wp_save_post_revision' 243 add_action( 'pre_post_update', 'wp_save_post_revision', 10, 2 ); 244 244 add_action( 'publish_post', '_publish_post_hook', 5, 1 ); 245 245 add_action( 'save_post', '_save_post_hook', 5, 2 ); 246 246 add_action( 'transition_post_status', '_transition_post_status', 5, 3 ); -
wp-includes/post.php
2533 2533 $where = array( 'ID' => $post_ID ); 2534 2534 2535 2535 if ( $update ) { 2536 do_action( 'pre_post_update', $post_ID );2536 do_action( 'pre_post_update', $post_ID, $data ); 2537 2537 if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) { 2538 2538 if ( $wp_error ) 2539 2539 return new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error); … … 4654 4654 * @param int $post_id The ID of the post to save as a revision. 4655 4655 * @return mixed Null or 0 if error, new revision ID, if success. 4656 4656 */ 4657 function wp_save_post_revision( $post_id ) {4657 function wp_save_post_revision( $post_id, $new_data = null ) { 4658 4658 // We do autosaves manually with wp_create_post_autosave() 4659 4659 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 4660 4660 return; … … 4668 4668 4669 4669 if ( !post_type_supports($post['post_type'], 'revisions') ) 4670 4670 return; 4671 4672 // if new data is supplied, check that it is different from last saved revision 4673 if( is_array( $new_data ) ) { 4674 $post_has_changed = false; 4675 foreach( array_keys( _wp_post_revision_fields() ) as $field ) { 4676 if( normalize_whitespace( $new_data[$field] ) != normalize_whitespace( $post[$field] ) ) { 4677 $post_has_changed = true; 4678 break; 4679 } 4680 } 4681 if( ! $post_has_changed ) 4682 return; 4683 } 4671 4684 4672 4685 $return = _wp_put_post_revision( $post ); 4673 4686