Ticket #2440: 2440-converter.php.2.diff
File 2440-converter.php.2.diff, 3.6 KB (added by , 11 years ago) |
---|
-
src/includes/admin/converter.php
497 497 498 498 break; 499 499 500 // STEP 11. Convert reply_to parents.500 // STEP 11. Convert comments. 501 501 case 11 : 502 if ( $converter->convert_comments( $start ) ) { 503 update_option( '_bbp_converter_step', $step + 1 ); 504 update_option( '_bbp_converter_start', 0 ); 505 if ( empty( $start ) ) { 506 $this->converter_output( __( 'No comments to convert', 'bbpress' ) ); 507 } 508 } else { 509 update_option( '_bbp_converter_start', $max + 1 ); 510 $this->converter_output( sprintf( __( 'Converting comments (%1$s - %2$s)', 'bbpress' ), $min, $max ) ); 511 } 512 513 break; 514 515 // STEP 12. Convert reply_to parents. 516 case 12 : 502 517 if ( $converter->convert_reply_to_parents( $start ) ) { 503 518 update_option( '_bbp_converter_step', $step + 1 ); 504 519 update_option( '_bbp_converter_start', 0 ); … … 722 737 'default' => 'topic' 723 738 ); 724 739 725 /** Post Section ******************************************************/740 /** Reply Section *****************************************************/ 726 741 727 742 $this->field_map[] = array( 728 743 'to_type' => 'reply', … … 745 760 'default' => 'reply' 746 761 ); 747 762 763 /** Comment Section ***************************************************/ 764 765 $this->field_map[] = array( 766 'to_type' => 'comment', 767 'to_fieldname' => 'post_status', 768 'default' => 'publish' 769 ); 770 $this->field_map[] = array( 771 'to_type' => 'comment', 772 'to_fieldname' => 'comment_status', 773 'default' => 'closed' 774 ); 775 $this->field_map[] = array( 776 'to_type' => 'comment', 777 'to_fieldname' => 'ping_status', 778 'default' => 'closed' 779 ); 780 $this->field_map[] = array( 781 'to_type' => 'comment', 782 'to_fieldname' => 'post_type', 783 'default' => 'reply' 784 ); 785 748 786 /** User Section ******************************************************/ 749 787 750 788 $this->field_map[] = array( … … 769 807 } 770 808 771 809 /** 772 * Convert Posts810 * Convert Reples / Posts 773 811 */ 774 812 public function convert_replies( $start = 1 ) { 775 813 return $this->convert_table( 'reply', $start ); … … 776 814 } 777 815 778 816 /** 817 * Convert Comments 818 */ 819 public function convert_comments( $start = 1 ) { 820 return $this->convert_table( 'comment', $start ); 821 } 822 823 /** 779 824 * Convert Users 780 825 */ 781 826 public function convert_users( $start = 1 ) { … … 893 938 // Loop through field map, again... 894 939 foreach ( $this->field_map as $row ) { 895 940 896 // Types match and to_fieldname is present. This means941 // Types match and to_fieldname is present. This means 897 942 // we have some work to do here. 898 943 if ( ( $row['to_type'] == $to_type ) && ! is_null( $row['to_fieldname'] ) ) { 899 944 … … 986 1031 'slug' => $insert_postmeta['slug'] 987 1032 ) ); 988 1033 } 989 1034 break; 990 1035 991 /** Forum, Topic, Reply ***************************/1036 /** Forum, Topic, Reply, Comment ******************/ 992 1037 993 1038 default: 994 1039 $post_id = wp_insert_post( $insert_post ); … … 1458 1503 $found = false; 1459 1504 1460 1505 if ( $curdir = opendir( bbpress()->admin->admin_dir . 'converters/' ) ) { 1461 while ( $file = readdir( $curdir) ) {1506 while ( false !== ( $file = readdir( $curdir ) ) ) { 1462 1507 if ( stristr( $file, '.php' ) && stristr( $file, 'index' ) === FALSE ) { 1463 1508 $file = preg_replace( '/.php/', '', $file ); 1464 1509 if ( $platform == $file ) {