Ticket #18948: 18948.5.diff
File 18948.5.diff, 13.0 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/bookmark.php
diff --git wp-admin/includes/bookmark.php wp-admin/includes/bookmark.php index b3a5185..537f96d 100644
function wp_delete_link( $link_id ) { 83 83 84 84 wp_delete_object_term_relationships( $link_id, 'link_category' ); 85 85 86 $wpdb-> query( $wpdb->prepare( "DELETE FROM $wpdb->links WHERE link_id = %d", $link_id) );86 $wpdb->delete( $wpdb->links, array( 'link_id' => $link_id ), array( '%d' ) ); 87 87 88 88 do_action( 'deleted_link', $link_id ); 89 89 -
wp-admin/includes/ms.php
diff --git wp-admin/includes/ms.php wp-admin/includes/ms.php index 8d9a673..d064968 100644
function wpmu_delete_blog( $blog_id, $drop = false ) { 89 89 $wpdb->query( "DROP TABLE IF EXISTS `$table`" ); 90 90 } 91 91 92 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->blogs WHERE blog_id = %d", $blog_id ) ); 92 $wpdb->delete( $wpdb->blogs, array( 'blog_id' => $blog_id ), array( '%d' ) ); 93 93 94 $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . "/blogs.dir/{$blog_id}/files/", $blog_id ); 94 95 $dir = rtrim( $dir, DIRECTORY_SEPARATOR ); 95 96 $top_dir = $dir; … … function wpmu_delete_user( $id ) { 158 159 } 159 160 } 160 161 161 $wpdb-> query( $wpdb->prepare( "DELETE FROM $wpdb->users WHERE ID = %d", $id) );162 $wpdb-> query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );162 $wpdb->delete( $wpdb->users, array( "ID" => $id ), array( '%d' ) ); 163 $wpdb->delete( $wpdb->usermeta, array( "user_id" => $id ), array( '%d' ) ); 163 164 164 165 clean_user_cache( $id ); 165 166 -
wp-admin/includes/upgrade.php
diff --git wp-admin/includes/upgrade.php wp-admin/includes/upgrade.php index 50c5da2..e16a1b0 100644
As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d 302 302 303 303 // Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id. 304 304 if ( !is_super_admin( $user_id ) && $user_id != 1 ) 305 $wpdb-> query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $wpdb->base_prefix.'1_capabilities') );305 $wpdb->delete( $wpdb->usermeta, array( "user_id" => $user_id , "meta_key" => $wpdb->base_prefix.'1_capabilities' ), array( '%d' , '%s' ) ); 306 306 } 307 307 } 308 308 endif; -
wp-admin/includes/user.php
diff --git wp-admin/includes/user.php wp-admin/includes/user.php index e915fa8..033d5cd 100644
function wp_delete_user( $id, $reassign = 'novalue' ) { 266 266 267 267 // FINALLY, delete user 268 268 if ( !is_multisite() ) { 269 $wpdb-> query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );270 $wpdb-> query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) );269 $wpdb->delete( $wpdb->usermeta, array( "user_id" => $id ), array( '%d' ) ); 270 $wpdb->delete( $wpdb->users, array( "ID" => $id ), array( '%d' ) ); 271 271 } else { 272 272 $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels 273 $wpdb-> query("DELETE FROM $wpdb->usermeta WHERE user_id = $id AND meta_key = '{$level_key}'");273 $wpdb->delete( $wpdb->usermeta, array( "user_id" => $id , "meta_key" => $level_key ), array( '%d' , '%s' ) ); 274 274 } 275 275 276 276 // allow for commit transaction -
wp-includes/comment.php
diff --git wp-includes/comment.php wp-includes/comment.php index dd4179c..1073b83 100644
function wp_delete_comment($comment_id, $force_delete = false) { 988 988 do_action( 'deleted_commentmeta', $meta_ids ); 989 989 } 990 990 991 if ( ! $wpdb-> query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id)) )991 if ( ! $wpdb->delete( $wpdb->comments, array( "comment_ID" => $comment_id ), array( '%d' ), 1 ) ) 992 992 return false; 993 993 do_action('deleted_comment', $comment_id); 994 994 -
wp-includes/meta.php
diff --git wp-includes/meta.php wp-includes/meta.php index 3caa808..99887f8 100644
function delete_metadata_by_mid( $meta_type, $meta_id ) { 489 489 do_action( 'delete_postmeta', $meta_id ); 490 490 491 491 // Run the query, will return true if deleted, false otherwise 492 $result = (bool) $wpdb-> query( $wpdb->prepare( "DELETE FROM $table WHERE $id_column = %d LIMIT 1;", $meta_id ));492 $result = (bool) $wpdb->delete( $table, array( $id_column => $meta_id ), array( '%d' ) , 1 ); 493 493 494 494 // Clear the caches. 495 495 wp_cache_delete($object_id, $meta_type . '_meta'); -
wp-includes/ms-functions.php
diff --git wp-includes/ms-functions.php wp-includes/ms-functions.php index 34d3310..9ca0e88 100644
function wpmu_validate_user_signup($user_name, $user_email) { 498 498 $diff = $now - $registered_at; 499 499 // If registered more than two days ago, cancel registration and let this signup go through. 500 500 if ( $diff > 172800 ) 501 $wpdb-> query( $wpdb->prepare("DELETE FROM $wpdb->signups WHERE user_login = %s", $user_name) );501 $wpdb->delete( $wpdb->signups, array( "user_login" => $user_name ), array( '%s' ) ); 502 502 else 503 503 $errors->add('user_name', __('That username is currently reserved but may be available in a couple of days.')); 504 504 … … function wpmu_validate_user_signup($user_name, $user_email) { 511 511 $diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered); 512 512 // If registered more than two days ago, cancel registration and let this signup go through. 513 513 if ( $diff > 172800 ) 514 $wpdb-> query( $wpdb->prepare("DELETE FROM $wpdb->signups WHERE user_email = %s", $user_email) );514 $wpdb->delete( $wpdb->signups, array( "user_email" => $user_email ), array( '%s' ) ); 515 515 else 516 516 $errors->add('user_email', __('That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.')); 517 517 } … … function wpmu_validate_blog_signup($blogname, $blog_title, $user = '') { 614 614 $diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered); 615 615 // If registered more than two days ago, cancel registration and let this signup go through. 616 616 if ( $diff > 172800 ) 617 $wpdb-> query( $wpdb->prepare("DELETE FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path) );617 $wpdb->delete( $wpdb->signups, array( "domain" => $mydomain , "path" => $path ), array( '%s' , '%s' ) ); 618 618 else 619 619 $errors->add('blogname', __('That site is currently reserved but may be available in a couple days.')); 620 620 } … … function install_blog($blog_id, $blog_title = '') { 1161 1161 $wpdb->update( $wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email') ); 1162 1162 1163 1163 // remove all perms 1164 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE meta_key = %s", $table_prefix.'user_level') ); 1165 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE meta_key = %s", $table_prefix.'capabilities') ); 1164 $wpdb->delete( $wpdb->usermeta, array( "meta_key" => $table_prefix.'user_level' ), array( '%s' ) ); 1165 1166 $wpdb->delete( $wpdb->usermeta, array( "meta_key" => $table_prefix.'capabilities' ), array( '%s' ) ); 1166 1167 1167 1168 $wpdb->suppress_errors( false ); 1168 1169 } -
wp-includes/option.php
diff --git wp-includes/option.php wp-includes/option.php index 9e4fe15..4a61ac2 100644
function delete_option( $option ) { 367 367 if ( is_null( $row ) ) 368 368 return false; 369 369 do_action( 'delete_option', $option ); 370 $result = $wpdb-> query( $wpdb->prepare( "DELETE FROM $wpdb->options WHERE option_name = %s", $option) );370 $result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ), array( '%s' ) ); 371 371 if ( ! defined( 'WP_INSTALLING' ) ) { 372 372 if ( 'yes' == $row->autoload ) { 373 373 $alloptions = wp_load_alloptions(); … … function delete_site_option( $option ) { 857 857 $cache_key = "{$wpdb->siteid}:$option"; 858 858 wp_cache_delete( $cache_key, 'site-options' ); 859 859 860 $result = $wpdb-> query( $wpdb->prepare( "DELETE FROM {$wpdb->sitemeta} WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid) );860 $result = $wpdb->delete( $wpdb->sitemeta, array( 'meta_key' => $option, 'site_id' => $wpdb->siteid ), array( '%s' , '%d' ) ); 861 861 } 862 862 863 863 if ( $result ) { -
wp-includes/post.php
diff --git wp-includes/post.php wp-includes/post.php index 2bdd51b..2ed1084 100644
function wp_delete_post( $postid = 0, $force_delete = false ) { 2037 2037 } 2038 2038 2039 2039 do_action( 'delete_post', $postid ); 2040 $wpdb-> query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid ));2040 $wpdb->delete( $wpdb->posts, array( "ID" => $postid ), array( '%d' ) ); 2041 2041 do_action( 'deleted_post', $postid ); 2042 2042 2043 2043 if ( 'page' == $post->post_type ) { … … function wp_delete_attachment( $post_id, $force_delete = false ) { 3789 3789 wp_delete_object_term_relationships($post_id, array('category', 'post_tag')); 3790 3790 wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type)); 3791 3791 3792 $wpdb-> query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id' AND meta_value = %d", $post_id ));3792 $wpdb->delete( $wpdb->postmeta, array( "meta_key" => '_thumbnail_id' , "meta_value" => $post_id ), array( '%s' , '%d' ) ); 3793 3793 3794 3794 $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id )); 3795 3795 if ( ! empty( $comment_ids ) ) { … … function wp_delete_attachment( $post_id, $force_delete = false ) { 3808 3808 } 3809 3809 3810 3810 do_action( 'delete_post', $post_id ); 3811 $wpdb-> query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $post_id ));3811 $wpdb->delete( $wpdb->posts, array( "ID" => $post_id ), array( '%d' ) ); 3812 3812 do_action( 'deleted_post', $post_id ); 3813 3813 3814 3814 $uploadpath = wp_upload_dir(); -
wp-includes/taxonomy.php
diff --git wp-includes/taxonomy.php wp-includes/taxonomy.php index 5f377f6..402d7f2 100644
function wp_delete_term( $term, $taxonomy, $args = array() ) { 1803 1803 clean_object_term_cache( $objects, $object_type ); 1804 1804 1805 1805 do_action( 'delete_term_taxonomy', $tt_id ); 1806 $wpdb-> query( $wpdb->prepare( "DELETE FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $tt_id) );1806 $wpdb->delete( $wpdb->term_taxonomy, array( "term_taxonomy_id" => $tt_id ), array( '%d' ) ); 1807 1807 do_action( 'deleted_term_taxonomy', $tt_id ); 1808 1808 1809 1809 // Delete the term if no taxonomies use it. 1810 1810 if ( !$wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = %d", $term) ) ) 1811 $wpdb-> query( $wpdb->prepare( "DELETE FROM $wpdb->terms WHERE term_id = %d", $term) );1811 $wpdb->delete( $wpdb->terms, array( "term_id" => $term ), array( '%d' ) ); 1812 1812 1813 1813 clean_term_cache($term, $taxonomy); 1814 1814 -
wp-includes/wp-db.php
diff --git wp-includes/wp-db.php wp-includes/wp-db.php index 2347c91..c80f9b0 100644
class wpdb { 404 404 * Keys are column names, values are format types: 'ID' => '%d' 405 405 * 406 406 * @since 2.8.0 407 * @see wpdb:prepare() 408 * @see wpdb:insert() 409 * @see wpdb:update() 407 * @see wpdb::prepare() 408 * @see wpdb::insert() 409 * @see wpdb::update() 410 * @see wpdb::delete() 410 411 * @see wp_set_wpdb_vars() 411 412 * @access public 412 413 * @var array … … class wpdb { 1272 1273 } 1273 1274 1274 1275 /** 1276 * Delete a row in the table 1277 * 1278 * <code> 1279 * wpdb::delete( 'table', array( 'ID' => 1 ) ) 1280 * wpdb::delete( 'table', array( 'ID' => 1 ), array( '%d' ) ) 1281 * wpdb::delete( 'table', array( 'ID' => 1 ), array( '%d' ), 1 ) 1282 * </code> 1283 * 1284 * @since 2.5.0 1285 * @see wpdb::prepare() 1286 * @see wpdb::$field_types 1287 * @see wp_set_wpdb_vars() 1288 * 1289 * @param string $table table name 1290 * @param array $where A named array of WHERE clauses (in column => value pairs). Multiple clauses will be joined with ANDs. Both $where columns and $where values should be "raw". 1291 * @param array|string $where_format Optional. An array of formats to be mapped to each of the values in $where. If string, that format will be used for all of the items in $where. A format is one of '%d', '%f', '%s' (integer, float, string). If omitted, all values in $where will be treated as strings unless otherwise specified in wpdb::$field_types. 1292 * @param int $limit Optional. An int to limit the number of rows to delete. 1293 * @return int|false The number of rows updated, or false on error. 1294 */ 1295 function delete( $table, $where, $where_format = null, $limit = null ) { 1296 if ( ! is_array( $where ) ) 1297 return false; 1298 1299 $bits = $wheres = array(); 1300 1301 $where_formats = $where_format = (array) $where_format; 1302 1303 foreach ( array_keys( $where ) as $field ) { 1304 if ( !empty( $where_format ) ) { 1305 $form = ( $form = array_shift( $where_formats ) ) ? $form : $where_format[0]; 1306 } elseif ( isset( $this->field_types[$field] ) ) { 1307 $form = $this->field_types[$field]; 1308 } else { 1309 $form = '%s'; 1310 } 1311 1312 $wheres[] = "$field = $form"; 1313 } 1314 1315 $limits = ''; 1316 if ( !empty( $limit ) ) { 1317 $limits = ' LIMIT ' . (int) $limit; 1318 } 1319 1320 $sql = "DELETE FROM $table WHERE " . implode( ' AND ', $wheres ) . $limits; 1321 return $this->query( $this->prepare( $sql, $where ) ); 1322 } 1323 1324 1325 /** 1275 1326 * Retrieve one variable from the database. 1276 1327 * 1277 1328 * Executes a SQL query and returns the value from the SQL result.