Changeset 4055
- Timestamp:
- 07/04/2012 03:28:57 AM (11 years ago)
- Location:
- branches/plugin/bbp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-converter.php
r4053 r4055 126 126 register_setting ( 'bbpress_converter_opt', '_bbp_converter_convert_users', 'intval' ); 127 127 128 // Restart 129 add_settings_field( '_bbp_converter_restart', __( 'Start Over', 'bbpress' ), 'bbp_converter_setting_callback_restart', 'bbpress_converter', 'bbpress_converter_opt' ); 130 register_setting ( 'bbpress_converter_opt', '_bbp_converter_restart', 'intval' ); 131 128 132 // Clean 129 add_settings_field( '_bbp_converter_clean', __( ' Clean','bbpress' ), 'bbp_converter_setting_callback_clean', 'bbpress_converter', 'bbpress_converter_opt' );133 add_settings_field( '_bbp_converter_clean', __( 'Purge Previous Import', 'bbpress' ), 'bbp_converter_setting_callback_clean', 'bbpress_converter', 'bbpress_converter_opt' ); 130 134 register_setting ( 'bbpress_converter_opt', '_bbp_converter_clean', 'intval' ); 131 132 // Restart133 add_settings_field( '_bbp_converter_restart', __( 'Restart', 'bbpress' ), 'bbp_converter_setting_callback_restart', 'bbpress_converter', 'bbpress_converter_opt' );134 register_setting ( 'bbpress_converter_opt', '_bbp_converter_restart', 'intval' );135 135 } 136 136 … … 337 337 update_option( '_bbp_converter_step', $step + 1 ); 338 338 update_option( '_bbp_converter_start', 0 ); 339 $this->sync_table( );339 $this->sync_table( true ); 340 340 if ( empty( $start ) ) { 341 341 $this->converter_output( __( 'No data to clean', 'bbpress' ) ); … … 510 510 511 511 $table_name = $wpdb->prefix . 'bbp_converter_translator'; 512 if ( $wpdb->get_var( "SHOW TABLES LIKE '{$table_name}'" ) == $table_name ) {512 if ( ! empty( $drop ) && $wpdb->get_var( "SHOW TABLES LIKE '{$table_name}'" ) == $table_name ) 513 513 $wpdb->query( "DROP TABLE {$table_name}" ); 514 } 515 516 if ( empty( $drop ) ) { 517 require_once( ABSPATH . '/wp-admin/includes/upgrade.php' ); 518 519 if ( !empty( $wpdb->charset ) ) { 520 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 521 } 522 523 if ( !empty( $wpdb->collate ) ) { 524 $charset_collate .= " COLLATE $wpdb->collate"; 525 } 526 527 /** Translator ****************************************************/ 528 529 $sql = "CREATE TABLE {$table_name} ( 530 meta_id mediumint(8) unsigned not null auto_increment, 531 value_type varchar(25) null, 532 value_id bigint(20) unsigned not null default '0', 533 meta_key varchar(25) null, 534 meta_value varchar(25) null, 535 PRIMARY KEY (meta_id), 536 KEY value_id (value_id), 537 KEY meta_join (meta_key, meta_value) ) {$charset_collate};"; 538 539 dbDelta( $sql ); 540 } 514 515 require_once( ABSPATH . '/wp-admin/includes/upgrade.php' ); 516 517 if ( !empty( $wpdb->charset ) ) { 518 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 519 } 520 521 if ( !empty( $wpdb->collate ) ) { 522 $charset_collate .= " COLLATE $wpdb->collate"; 523 } 524 525 /** Translator ****************************************************/ 526 527 $sql = "CREATE TABLE {$table_name} ( 528 meta_id mediumint(8) unsigned not null auto_increment, 529 value_type varchar(25) null, 530 value_id bigint(20) unsigned not null default '0', 531 meta_key varchar(25) null, 532 meta_value varchar(25) null, 533 PRIMARY KEY (meta_id), 534 KEY value_id (value_id), 535 KEY meta_join (meta_key, meta_value) ) {$charset_collate};"; 536 537 dbDelta( $sql ); 541 538 } 542 539 } … … 1040 1037 $posts = $this->wpdb->get_results( $query, ARRAY_A ); 1041 1038 1042 if ( !empty( $posts) ) {1039 if ( isset( $posts[0] ) && ! empty( $posts[0]['value_id'] ) ) { 1043 1040 foreach ( (array) $posts as $value ) { 1044 1041 wp_delete_post( $value['value_id'], true ); -
branches/plugin/bbp-admin/bbp-settings.php
r4053 r4055 1123 1123 1124 1124 /** 1125 * Edit Restart setting field 1126 * 1127 * @since bbPress (r3813) 1128 */ 1129 function bbp_converter_setting_callback_restart() { 1130 ?> 1131 1132 <input id="_bbp_converter_restart" name="_bbp_converter_restart" type="checkbox" id="_bbp_converter_restart" value="1" <?php checked( get_option( '_bbp_converter_restart', false ) ); ?> /> 1133 <label for="_bbp_converter_restart"><?php _e( 'Start a fresh conversion from the beginning', 'bbpress' ); ?></label> 1134 <p class="description"><?php _e( 'You should clean old conversion information before starting over.', 'bbpress' ); ?></p> 1135 1136 <?php 1137 } 1138 1139 /** 1125 1140 * Edit Clean setting field 1126 1141 * … … 1132 1147 <input id="_bbp_converter_clean" name="_bbp_converter_clean" type="checkbox" id="_bbp_converter_clean" value="1" <?php checked( get_option( '_bbp_converter_clean', false ) ); ?> /> 1133 1148 <label for="_bbp_converter_clean"><?php _e( 'Purge all information from a previously attempted import', 'bbpress' ); ?></label> 1134 <p class="description"><?php _e( 'Use this if an import failed and you want to start over from scratch.', 'bbpress' ); ?></p> 1135 1136 <?php 1137 } 1138 1139 /** 1140 * Edit Restart setting field 1141 * 1142 * @since bbPress (r3813) 1143 */ 1144 function bbp_converter_setting_callback_restart() { 1145 ?> 1146 1147 <input id="_bbp_converter_restart" name="_bbp_converter_restart" type="checkbox" id="_bbp_converter_restart" value="1" <?php checked( get_option( '_bbp_converter_restart', false ) ); ?> /> 1148 <label for="_bbp_converter_restart"><?php _e( 'Restart conversion from the beginning', 'bbpress' ); ?></label> 1149 <p class="description"><?php _e( 'The importer keeps track of where it left off in the event of failure.', 'bbpress' ); ?></p> 1149 <p class="description"><?php _e( 'Use this if an import failed and you want to remove that incomplete data.', 'bbpress' ); ?></p> 1150 1150 1151 1151 <?php
Note: See TracChangeset
for help on using the changeset viewer.