Make WordPress Core

Ticket #7392: 7392.diff

File 7392.diff, 2.3 KB (added by solarissmoke, 14 years ago)
  • wp-includes/default-filters.php

     
    240240add_action( 'plugins_loaded',             'wp_maybe_load_widgets',    0    );
    241241add_action( 'plugins_loaded',             'wp_maybe_load_embeds',     0    );
    242242add_action( 'shutdown',                   'wp_ob_end_flush_all',      1    );
    243 add_action( 'pre_post_update',            'wp_save_post_revision'          );
     243add_action( 'pre_post_update',            'wp_save_post_revision',   10, 2 );
    244244add_action( 'publish_post',               '_publish_post_hook',       5, 1 );
    245245add_action( 'save_post',                  '_save_post_hook',          5, 2 );
    246246add_action( 'transition_post_status',     '_transition_post_status',  5, 3 );
  • wp-includes/post.php

     
    25332533        $where = array( 'ID' => $post_ID );
    25342534
    25352535        if ( $update ) {
    2536                 do_action( 'pre_post_update', $post_ID );
     2536                do_action( 'pre_post_update', $post_ID, $data );
    25372537                if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
    25382538                        if ( $wp_error )
    25392539                                return new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error);
     
    46544654 * @param int $post_id The ID of the post to save as a revision.
    46554655 * @return mixed Null or 0 if error, new revision ID, if success.
    46564656 */
    4657 function wp_save_post_revision( $post_id ) {
     4657function wp_save_post_revision( $post_id, $new_data = null ) {
    46584658        // We do autosaves manually with wp_create_post_autosave()
    46594659        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
    46604660                return;
     
    46684668
    46694669        if ( !post_type_supports($post['post_type'], 'revisions') )
    46704670                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        }
    46714684
    46724685        $return = _wp_put_post_revision( $post );
    46734686