Ticket #6265: wp-importer.patch
File wp-importer.patch, 1.9 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_name, '', $post_date); 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($post_name, $content = '', $post_date = '') { 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 202 if (!empty ($content)) 203 203 return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date"); … … 609 609 if (in_array($post->post_status, array('draft', 'pending'))) { 610 610 $post->post_status = 'publish'; 611 611 $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); 613 613 } 614 614 615 615 // If the user wants to set a new name -- override the current one