Changeset 12652
- Timestamp:
- 01/07/2010 08:13:54 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/import/wordpress.php
r12515 r12652 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 } -
trunk/wp-admin/import/wp-cat2tag.php
r12515 r12652 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 … … 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"; … … 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; … … 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 } … … 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'"; 401 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) ); 399 } else { 400 $new_fields = array('taxonomy' => 'category', 'parent' => 0); 401 } 402 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; -
trunk/wp-admin/includes/bookmark.php
r12515 r12652 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 ); … … 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 ); -
trunk/wp-admin/includes/template.php
r12616 r12652 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)); 1780 1780 clean_page_cache( $page->ID ); 1781 1781 } -
trunk/wp-admin/includes/user.php
r12341 r12652 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 -
trunk/wp-includes/post.php
r12651 r12652 3788 3788 $revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) ); 3789 3789 3790 // WP_POST_REVISIONS = (int) (# of aut asaves to save)3790 // WP_POST_REVISIONS = (int) (# of autosaves to save) 3791 3791 $delete = count($revisions) - WP_POST_REVISIONS; 3792 3792
Note: See TracChangeset
for help on using the changeset viewer.