WordPress.org

Make WordPress Core

Ticket #6265: wp-importer.patch

File wp-importer.patch, 1.9 KB (added by jayminkapish, 10 years ago)

importer patch for wordpress

  • wp-admin/import/wordpress.php

     
    338338                $post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
    339339                if ( $post_ID && !empty($this->post_ids_processed[$post_ID]) ) // Processed already
    340340                        return 0;
    341                
     341
    342342                set_time_limit( 60 );
    343343
    344344                // There are only ever one of these
     
    379379                        $cat_index++;
    380380                }
    381381
    382                 $post_exists = post_exists($post_title, '', $post_date);
     382                $post_exists = post_exists($post_name, '', $post_date);
    383383
    384384                if ( $post_exists ) {
    385385                        echo '<li>';
  • wp-admin/includes/post.php

     
    190190        return $post;
    191191}
    192192
    193 function post_exists($title, $content = '', $post_date = '') {
     193function post_exists($post_name, $content = '', $post_date = '') {
    194194        global $wpdb;
    195195
    196196        if (!empty ($post_date))
    197197                $post_date = "AND post_date = '$post_date'";
    198198
    199         if (!empty ($title))
    200                 return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' $post_date");
     199        if (!empty ($post_name))
     200                return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$post_name' $post_date");
    201201        else
    202202                if (!empty ($content))
    203203                        return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date");
     
    609609        if (in_array($post->post_status, array('draft', 'pending'))) {
    610610                $post->post_status = 'publish';
    611611                $post->post_date = date('Y-m-d H:i:s');
    612                 $post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID); 
     612                $post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID);
    613613        }
    614614
    615615        // If the user wants to set a new name -- override the current one