Changeset 4003 for branches/plugin/bbp-admin/bbp-converter.php
- Timestamp:
- 06/23/2012 06:49:39 AM (14 years ago)
- File:
-
- 1 edited
-
branches/plugin/bbp-admin/bbp-converter.php (modified) (33 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-converter.php
r4000 r4003 146 146 padding: 2px; 147 147 } 148 148 149 149 div.bbp-converter-updated p strong.loading { 150 150 padding: 2px 20px 2px 0; … … 176 176 values[field.name] = field.value; 177 177 }); 178 178 179 179 if( values['_bbp_converter_restart'] ) { 180 180 jQuery('#_bbp_converter_restart').removeAttr("checked"); … … 219 219 function bbconverter_success(response) { 220 220 bbconverter_log(response); 221 221 222 222 if ( response == 'Conversion Complete' || response.indexOf('error') > -1 ) { 223 223 bbconverter_log('<b>Repair any missing information: <a href="<?php echo admin_url(); ?>tools.php?page=bbp-repair">Continue</a></b>'); … … 276 276 $step = (int) get_option( '_bbp_converter_step', 1 ); 277 277 $min = (int) get_option( '_bbp_converter_start', 0 ); 278 $count = (int) empty( $_POST['_bbp_converter_rows'] ) ? $_POST['_bbp_converter_rows'] : 100;278 $count = (int) ! empty( $_POST['_bbp_converter_rows'] ) ? $_POST['_bbp_converter_rows'] : 100; 279 279 $max = ( $min + $count ) - 1; 280 280 $start = $min; … … 297 297 update_option( '_bbp_converter_start', 0 ); 298 298 $this->sync_table(); 299 300 299 if ( empty( $start ) ) { 301 300 _e( 'No data to clean', 'bbpress' ); … … 303 302 } else { 304 303 update_option( '_bbp_converter_start', $max + 1 ); 305 306 _e( 'Deleting previously converted data (' . $min . ' - ' . $max . ')', 'bbpress' ); 304 printf( __( 'Deleting previously converted data (%1$s - %2$s)', 'bbpress' ), $min, $max ); 307 305 } 308 306 } else { … … 310 308 update_option( '_bbp_converter_start', 0 ); 311 309 } 312 310 313 311 break; 314 312 … … 319 317 update_option( '_bbp_converter_step', $step + 1 ); 320 318 update_option( '_bbp_converter_start', 0 ); 321 322 319 if ( empty( $start ) ) { 323 320 _e( 'No users to convert', 'bbpress' ); … … 325 322 } else { 326 323 update_option( '_bbp_converter_start', $max + 1 ); 327 328 _e( 'Converting users (' . $min . ' - ' . $max . ')', 'bbpress' ); 324 printf( __( 'Converting users (%1$s - %2$s)', 'bbpress' ), $min, $max ); 329 325 } 330 326 } else { … … 341 337 update_option( '_bbp_converter_step', $step + 1 ); 342 338 update_option( '_bbp_converter_start', 0 ); 343 344 339 if ( empty( $start ) ) { 345 340 _e( 'No passwords to clear', 'bbpress' ); … … 347 342 } else { 348 343 update_option( '_bbp_converter_start', $max + 1 ); 349 350 _e( 'Delete users wordpress default passwords (' . $min . ' - ' . $max . ')', 'bbpress' ); 344 printf( __( 'Delete users wordpress default passwords (%1$s - %2$s)', 'bbpress' ), $min, $max ); 351 345 } 352 346 } else { … … 362 356 update_option( '_bbp_converter_step', $step + 1 ); 363 357 update_option( '_bbp_converter_start', 0 ); 364 365 358 if ( empty( $start ) ) { 366 359 _e( 'No forums to convert', 'bbpress' ); … … 368 361 } else { 369 362 update_option( '_bbp_converter_start', $max + 1 ); 370 371 _e( 'Converting forums (' . $min . ' - ' . $max . ')', 'bbpress' ); 363 printf( __( 'Converting forums (%1$s - %2$s)', 'bbpress' ), $min, $max ); 372 364 } 373 365 … … 376 368 // STEP 5. Convert forum parents. 377 369 case 5 : 378 370 379 371 if ( $converter->convert_forum_parents( $start ) ) { 380 372 update_option( '_bbp_converter_step', $step + 1 ); 381 373 update_option( '_bbp_converter_start', 0 ); 382 383 374 if ( empty( $start ) ) { 384 375 _e( 'No forum parents to convert', 'bbpress' ); … … 386 377 } else { 387 378 update_option( '_bbp_converter_start', $max + 1 ); 388 389 _e( 'Converting forum parents (' . $min . ' - ' . $max . ')', 'bbpress' ); 379 printf( __( 'Calculating forum hierarchy (%1$s - %2$s)', 'bbpress' ), $min, $max ); 390 380 } 391 381 … … 398 388 update_option( '_bbp_converter_step', $step + 1 ); 399 389 update_option( '_bbp_converter_start', 0 ); 400 401 if ( !$start ) { 390 if ( empty( $start ) ) { 402 391 _e( 'No topics to convert', 'bbpress' ); 403 392 } 404 393 } else { 405 394 update_option( '_bbp_converter_start', $max + 1 ); 406 407 _e( 'Converting topics (' . $min . ' - ' . $max . ')', 'bbpress' ); 395 printf( __( 'Converting topics (%1$s - %2$s)', 'bbpress' ), $min, $max ); 408 396 } 409 397 … … 412 400 // STEP 7. Convert tags. 413 401 case 7 : 414 402 415 403 if ( $converter->convert_tags( $start ) ) { 416 404 update_option( '_bbp_converter_step', $step + 1 ); 417 405 update_option( '_bbp_converter_start', 0 ); 418 419 406 if ( empty( $start ) ) { 420 407 _e( 'No tags to convert', 'bbpress' ); … … 422 409 } else { 423 410 update_option( '_bbp_converter_start', $max + 1 ); 424 425 _e( 'Converting tags (' . $min . ' - ' . $max . ')', 'bbpress' ); 411 printf( __( 'Converting topic tags (%1$s - %2$s)', 'bbpress' ), $min, $max ); 426 412 } 427 413 … … 438 424 } else { 439 425 update_option( '_bbp_converter_start', $max + 1 ); 440 441 _e( 'Converting replies (' . $min . ' - ' . $max . ')', 'bbpress' ); 426 printf( __( 'Converting replies (%1$s - %2$s)', 'bbpress' ), $min, $max ); 442 427 } 443 428 444 429 break; 445 430 446 431 default : 447 432 delete_option( '_bbp_converter_step' ); … … 451 436 452 437 break; 453 438 454 439 } 455 440 } … … 457 442 /** 458 443 * Convert passwords from previous forum to wordpress. 459 * 444 * 460 445 * @since bbPress (r3813) 461 446 * @global WPDB $wpdb … … 480 465 /** 481 466 * Create Tables for fast syncing 482 * 467 * 483 468 * @since bbPress (r3813) 484 469 */ … … 828 813 829 814 // Get some data from the old forums 830 $forum_array = $this->opdb->get_results( 'SELECT ' . implode( ',', $field_list ) . ' FROM ' . $this->opdb->prefix . $from_tablename . ' LIMIT ' . $start . ', ' . $this->max_rows, ARRAY_A ); 815 $field_list = array_unique( $field_list ); 816 $forum_query = 'SELECT ' . implode( ',', $field_list ) . ' FROM ' . $this->opdb->prefix . $from_tablename . ' LIMIT ' . $start . ', ' . $this->max_rows; 817 $forum_array = $this->opdb->get_results( $forum_query, ARRAY_A ); 818 819 // Output the query, for better debugging 820 printf( __( '<span title="%s">View Query</span>%s', 'bbpress' ), esc_attr( $forum_query ), '<br />' ); 831 821 832 822 // Query returned some results … … 849 839 // columns in this table. 850 840 if ( in_array( $row['to_fieldname'], $tablefield_array ) ) { 851 841 852 842 // Allows us to set default fields. 853 843 if ( isset( $row['default'] ) ) { … … 861 851 $insert_post[$row['to_fieldname']] = call_user_func_array( array( $this, $row['callback_method'] ), array( $forum[$row['from_fieldname']], $forum ) ); 862 852 } 863 853 864 854 // Maps the field from the old forum. 865 855 } else { … … 870 860 // to do some extra work or set a default. 871 861 } elseif ( !empty( $row['to_fieldname'] ) ) { 872 862 873 863 // Allows us to set default fields. 874 864 if ( isset( $row['default'] ) ) { … … 897 887 898 888 switch ( $to_type ) { 899 889 900 890 /** New user **************************************/ 901 891 … … 1088 1078 return $rval; 1089 1079 } 1090 1080 1091 1081 /** Callbacks *************************************************************/ 1092 1082 … … 1095 1085 * 1096 1086 * @param string $username 1097 * @param string $password 1087 * @param string $password 1098 1088 */ 1099 1089 public function callback_pass( $username, $password ) { … … 1115 1105 * 1116 1106 * @param string $field 1117 * @return string 1107 * @return string 1118 1108 */ 1119 1109 private function callback_forumid( $field ) { … … 1138 1128 * 1139 1129 * @param string $field 1140 * @return string 1130 * @return string 1141 1131 */ 1142 1132 private function callback_topicid( $field ) { … … 1161 1151 * 1162 1152 * @param string $field 1163 * @return string 1153 * @return string 1164 1154 */ 1165 1155 private function callback_userid( $field ) { … … 1188 1178 * 1189 1179 * @param string $field 1190 * @return string 1180 * @return string 1191 1181 */ 1192 1182 private function callback_topicid_to_forumid( $field ) {
Note: See TracChangeset
for help on using the changeset viewer.