Ticket #6265: wordpress-importer-new.patch
File wordpress-importer-new.patch, 2.2 KB (added by , 17 years ago) |
---|
-
wp-admin/import/wordpress.php
338 338 $post_ID = (int) $this->get_tag( $post, 'wp:post_id' ); 339 339 if ( $post_ID && !empty($this->post_ids_processed[$post_ID]) ) // Processed already 340 340 return 0; 341 341 342 342 set_time_limit( 60 ); 343 343 344 344 // There are only ever one of these … … 379 379 $cat_index++; 380 380 } 381 381 382 $post_exists = post_exists($post_title, '', $post_date );382 $post_exists = post_exists($post_title, '', $post_date, $post_name); 383 383 384 384 if ( $post_exists ) { 385 385 echo '<li>'; -
wp-admin/includes/post.php
190 190 return $post; 191 191 } 192 192 193 function post_exists($title, $content = '', $post_date = '' ) {193 function post_exists($title, $content = '', $post_date = '', $post_name = '') { 194 194 global $wpdb; 195 195 196 196 if (!empty ($post_date)) 197 197 $post_date = "AND post_date = '$post_date'"; 198 198 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"); 201 201 else 202 if (!empty ($content)) 203 return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date"); 202 if (!empty ($title)) 203 return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' $post_date"); 204 else 205 if (!empty ($content)) 206 return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date"); 204 207 205 208 return 0; 206 209 } … … 609 612 if (in_array($post->post_status, array('draft', 'pending'))) { 610 613 $post->post_status = 'publish'; 611 614 $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); 615 $post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID); 613 616 } 614 617 615 618 // If the user wants to set a new name -- override the current one