Ticket #6836: 6836.6.diff
File 6836.6.diff, 8.1 KB (added by , 15 years ago) |
---|
-
wp-admin/import/wordpress.php
747 747 $local_child_id = $this->post_ids_processed[$child_id]; 748 748 $local_parent_id = $this->post_ids_processed[$parent_id]; 749 749 if ($local_child_id and $local_parent_id) { 750 $wpdb-> query( $wpdb->prepare("UPDATE {$wpdb->posts} SET post_parent = %d WHERE ID = %d", $local_parent_id, $local_child_id));750 $wpdb->update($wpdb->posts, array('post_parent' => $local_parent_id), array('ID' => $local_child_id) ); 751 751 } 752 752 } 753 753 } -
wp-admin/import/wp-cat2tag.php
272 272 if ( $values ) { 273 273 $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)"); 274 274 275 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'", $category->count, $category->term_id) );275 $wpdb->update($wpdb->term_taxonomy, array('count' => $category->count), array('term_id' => $category->term_id, 'taxonomy' => 'post_tag') ); 276 276 } 277 277 278 278 echo __('Converted successfully.') . "</li>\n"; … … 292 292 $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)"); 293 293 294 294 $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tag_ttid) ); 295 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'", $count, $category->term_id) );295 $wpdb->update($wpdb->term_taxonomy, array('count' => $count), array('term_id' => $category->term_id, 'taxonomy' => 'post_tag') ); 296 296 } 297 297 echo __('Tag added to all posts in this category.') . " *</li>\n"; 298 298 … … 311 311 } 312 312 313 313 // Change the category to a tag. 314 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );314 $wpdb->update($wpdb->term_taxonomy, array('taxonomy' => 'post_tag'), array('term_id' => $category->term_id, 'taxonomy' => 'category') ); 315 315 316 316 // Set all parents to 0 (root-level) if their parent was the converted tag 317 $ parents = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = %d AND taxonomy = 'category'", $category->term_id) );317 $wpdb->update($wpdb->term_taxonomy, array('parent' => 0), array('parent' => $category->term_id, 'taxonomy' => 'category') ); 318 318 319 319 if ( $parents ) $clear_parents = true; 320 320 $clean_cat_cache[] = $category->term_id; … … 379 379 380 380 if ( $default_cat != $tag->term_id ) { 381 381 $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tag->term_id) ); 382 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'category'", $count, $tag->term_id) );382 $wpdb->update($wpdb->term_taxonomy, array('count' => $count), array('term_id' => $tag->term_id, 'taxonomy' => 'category') ); 383 383 } 384 384 } 385 385 … … 394 394 // Change the tag to a category. 395 395 $parent = $wpdb->get_var( $wpdb->prepare("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $tag->term_id) ); 396 396 if ( 0 == $parent || (0 < (int) $parent && $this->_category_exists($parent)) ) { 397 $ reset_parent = '';397 $new_fields = array('taxonomy' => 'category'); 398 398 $clear_parents = true; 399 } else 400 $reset_parent = ", parent = '0'"; 399 } else { 400 $new_fields = array('taxonomy' => 'category', 'parent' => 0); 401 } 401 402 402 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'category' $reset_parent WHERE term_id = %d AND taxonomy = 'post_tag'", $tag->term_id) );403 $wpdb->update($wpdb->term_taxonomy, $new_fields, array('term_id' => $tag->term_id, 'taxonomy' => 'post_tag') ); 403 404 404 405 $clean_term_cache[] = $tag->term_id; 405 406 $clean_cat_cache[] = $cat['term_id']; -
wp-admin/includes/bookmark.php
186 186 } 187 187 188 188 if ( $update ) { 189 if ( false === $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_url = %s, 190 link_name = %s, link_image = %s, link_target = %s, 191 link_visible = %s, link_description = %s, link_rating = %s, 192 link_rel = %s, link_notes = %s, link_rss = %s 193 WHERE link_id = %s", $link_url, $link_name, $link_image, $link_target, $link_visible, $link_description, $link_rating, $link_rel, $link_notes, $link_rss, $link_id ) ) ) { 189 if ( ! $wpdb->update( $wpdb->links, compact('link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_rating', 'link_rel', 'link_notes', 'link_rss'), compact('link_id') ) ) { 194 190 if ( $wp_error ) 195 191 return new WP_Error( 'db_update_error', __( 'Could not update link in the database' ), $wpdb->last_error ); 196 192 else 197 193 return 0; 198 194 } 199 195 } else { 200 if ( false === $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", 201 $link_url,$link_name, $link_image, $link_target, $link_description, $link_visible, $link_owner, $link_rating, $link_rel, $link_notes, $link_rss ) ) ) { 196 if ( ! $wpdb->insert( $wpdb->links, compact('link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss') ) ) { 202 197 if ( $wp_error ) 203 198 return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database' ), $wpdb->last_error ); 204 199 else -
wp-admin/includes/template.php
1776 1776 // catch and repair bad pages 1777 1777 if ( $page->post_parent == $page->ID ) { 1778 1778 $page->post_parent = 0; 1779 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID));1779 $wpdb->update($wpdb->posts, array('post_parent' => 0), array('ID' => $page->ID), array('post_parent' => '%d'), array('ID' => '%d')); 1780 1780 clean_page_cache( $page->ID ); 1781 1781 } 1782 1782 -
wp-admin/includes/user.php
435 435 436 436 } else { 437 437 $reassign = (int) $reassign; 438 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign,$id) );439 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign,$id) );438 $wpdb->update( $wpdb->posts, array('post_author' => $reassign), array('post_author' => $id) ); 439 $wpdb->update( $wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id) ); 440 440 } 441 441 442 442 // FINALLY, delete user -
wp-includes/post.php
3738 3738 // all revisions and (possibly) one autosave 3739 3739 $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) ); 3740 3740 3741 // WP_POST_REVISIONS = (int) (# of aut asaves to save)3741 // WP_POST_REVISIONS = (int) (# of autosaves to save) 3742 3742 $delete = count($revisions) - WP_POST_REVISIONS; 3743 3743 3744 3744 if ( $delete < 1 )