Changeset 6532 for trunk/wp-admin/import/wordpress.php
- Timestamp:
- 01/01/2008 05:03:52 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/import/wordpress.php
r6477 r6532 377 377 } 378 378 379 if ($post_id = post_exists($post_title, '', $post_date)) { 379 $post_exists = post_exists($post_title, '', $post_date); 380 381 if ( $post_exists ) { 380 382 echo '<li>'; 381 383 printf(__('Post <i>%s</i> already exists.'), stripslashes($post_title)); … … 476 478 $comment_parent = $this->get_tag( $comment, 'wp:comment_parent'); 477 479 478 if ( !comment_exists($comment_author, $comment_date) ) { 480 // if this is a new post we can skip the comment_exists() check 481 if ( !$post_exists || !comment_exists($comment_author, $comment_date) ) { 479 482 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_approved', 'comment_type', 'comment_parent'); 480 483 wp_insert_comment($commentdata); … … 649 652 } 650 653 654 function import_start() { 655 wp_defer_term_counting(true); 656 wp_defer_comment_counting(true); 657 do_action('import_start'); 658 } 659 660 function import_end() { 661 do_action('import_end'); 662 663 // clear the caches after backfilling 664 foreach ($this->post_ids_processed as $post_id) 665 clean_post_cache($post_id); 666 667 wp_defer_term_counting(false); 668 wp_defer_comment_counting(false); 669 } 651 670 652 671 function import($id, $fetch_attachments = false) { … … 655 674 656 675 add_filter('import_post_meta_key', array($this, 'is_valid_meta_key')); 657 do_action('import_start');658 676 $file = get_attached_file($this->id); 659 677 $this->import_file($file); 660 do_action('import_end');661 678 } 662 679 … … 664 681 $this->file = $file; 665 682 683 $this->import_start(); 666 684 $this->get_authors_from_post(); 667 wp_defer_term_counting(true);668 685 $this->get_entries(); 669 686 $this->process_categories(); … … 672 689 $this->backfill_parents(); 673 690 $this->backfill_attachment_urls(); 674 675 // clear the caches after backfilling 676 foreach ($this->post_ids_processed as $post_id) 677 clean_post_cache($post_id); 678 679 wp_defer_term_counting(false); 691 $this->import_end(); 692 680 693 if ( is_wp_error( $result ) ) 681 694 return $result;
Note: See TracChangeset
for help on using the changeset viewer.