Changeset 5525
- Timestamp:
- 09/19/2014 11:28:17 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/converter.php
r5466 r5525 1021 1021 add_post_meta( $post_id, $key, $value, true ); 1022 1022 1023 // Forums need to save their old ID for group forum association 1024 if ( ( 'forum' == $to_type ) && ( '_bbp_forum_id' == $key ) ) 1025 add_post_meta( $post_id, '_bbp_old_forum_id', $value ); 1026 1027 // Topics need an extra bit of metadata 1028 // to be keyed to the new post_id 1029 if ( ( 'topic' == $to_type ) && ( '_bbp_topic_id' == $key ) ) { 1030 1031 // Update the live topic ID 1032 update_post_meta( $post_id, $key, $post_id ); 1033 1034 // Save the old topic ID 1035 add_post_meta( $post_id, '_bbp_old_topic_id', $value ); 1036 if ( '_id' == substr( $key, -3 ) && ( true === $this->sync_table ) ) { 1037 $this->wpdb->insert( $this->sync_table_name, array( 'value_type' => 'post', 'value_id' => $post_id, 'meta_key' => '_bbp_topic_id', 'meta_value' => $post_id ) ); 1038 $this->wpdb->insert( $this->sync_table_name, array( 'value_type' => 'post', 'value_id' => $post_id, 'meta_key' => '_bbp_old_topic_id', 'meta_value' => $value ) ); 1039 } 1040 1041 } elseif ( '_id' == substr( $key, -3 ) && ( true === $this->sync_table ) ) { 1023 /** 1024 * If we are using the sync_table add 1025 * the meta '_id' keys to the table 1026 * 1027 * Forums: _bbp_old_forum_id // The old forum ID 1028 * _bbp_old_forum_parent_id // The old forum parent ID 1029 * 1030 * Topics: _bbp_forum_id // The new forum ID 1031 * _bbp_old_topic_id // The old topic ID 1032 * _bbp_old_closed_status_id // The old topic open/closed status 1033 * _bbp_old_sticky_status_id // The old topic sticky status 1034 * 1035 * Replies: _bbp_forum_id // The new forum ID 1036 * _bbp_topic_id // The new topic ID 1037 * _bbp_old_reply_id // The old reply ID 1038 */ 1039 if ( '_id' == substr( $key, -3 ) && ( true === $this->sync_table ) ) { 1042 1040 $this->wpdb->insert( $this->sync_table_name, array( 'value_type' => 'post', 'value_id' => $post_id, 'meta_key' => $key, 'meta_value' => $value ) ); 1043 1041 } … … 1356 1354 if ( !isset( $this->map_forumid[$field] ) ) { 1357 1355 if ( !empty( $this->sync_table ) ) { 1358 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_ forum_id" AND meta_value = "%s" LIMIT 1', $field ) );1356 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_forum_id" AND meta_value = "%s" LIMIT 1', $field ) ); 1359 1357 } else { 1360 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_forum_id" AND meta_value = "%s" LIMIT 1', $field ) );1358 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_forum_id" AND meta_value = "%s" LIMIT 1', $field ) ); 1361 1359 } 1362 1360 … … 1381 1379 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_topic_id" AND meta_value = "%s" LIMIT 1', $field ) ); 1382 1380 } else { 1383 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta. ' WHERE meta_key = "_bbp_old_topic_id" AND meta_value = "%s" LIMIT 1', $field ) );1381 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_topic_id" AND meta_value = "%s" LIMIT 1', $field ) ); 1384 1382 } 1385 1383 … … 1404 1402 if ( !isset( $this->map_reply_to[$field] ) ) { 1405 1403 if ( !empty( $this->sync_table ) ) { 1406 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_ post_id" AND meta_value = "%s" LIMIT 1', $field ) );1404 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT value_id, meta_value FROM ' . $this->sync_table_name . ' WHERE meta_key = "_bbp_old_reply_id" AND meta_value = "%s" LIMIT 1', $field ) ); 1407 1405 } else { 1408 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_post_id" AND meta_value = "%s" LIMIT 1', $field ) );1406 $row = $this->wpdb->get_row( $this->wpdb->prepare( 'SELECT post_id AS value_id FROM ' . $this->wpdb->postmeta . ' WHERE meta_key = "_bbp_old_reply_id" AND meta_value = "%s" LIMIT 1', $field ) ); 1409 1407 } 1410 1408
Note: See TracChangeset
for help on using the changeset viewer.