Ticket #7171: 7171.2.diff
File 7171.2.diff, 3.7 KB (added by , 16 years ago) |
---|
-
wp-includes/wp-db.php
255 255 'postmeta', 'terms', 'term_taxonomy', 'term_relationships'); 256 256 257 257 /** 258 * Format specifiers for DB columns. Columns not listed here default to %s. Initialized in wp-settings.php. 259 * 260 * Keys are colmn names, values are format types: 'ID' => '%d' 261 * 262 * @since 2.8.0 263 * @see wpdb:prepare() 264 * @see wpdb:insert() 265 * @see wpdb:update() 266 * @access public 267 * @war array 268 */ 269 var $field_type = array(); 270 271 /** 258 272 * Database table columns charset 259 273 * 260 274 * @since 2.2.0 … … 703 717 * @return mixed Results of $this->query() 704 718 */ 705 719 function insert($table, $data, $format = null) { 706 global $db_field_types;707 708 720 $formats = $format = (array) $format; 709 721 $fields = array_keys($data); 710 722 $formatted_fields = array(); 711 723 foreach ( $fields as $field ) { 712 724 if ( !empty($format) ) 713 725 $form = ( $form = array_shift($formats) ) ? $form : $format[0]; 714 elseif ( isset($ db_field_types[$field]) )715 $form = $ db_field_types[$field];726 elseif ( isset($this->field_types[$field]) ) 727 $form = $this->field_types[$field]; 716 728 else 717 729 $form = '%s'; 718 730 $formatted_fields[] = $form; … … 734 746 * @return mixed Results of $this->query() 735 747 */ 736 748 function update($table, $data, $where, $format = null, $where_format = null) { 737 global $db_field_types;738 739 749 if ( !is_array( $where ) ) 740 750 return false; 741 751 … … 744 754 foreach ( (array) array_keys($data) as $field ) { 745 755 if ( !empty($format) ) 746 756 $form = ( $form = array_shift($formats) ) ? $form : $format[0]; 747 elseif ( isset($ db_field_types[$field]) )748 $form = $ db_field_types[$field];757 elseif ( isset($this->field_types[$field]) ) 758 $form = $this->field_types[$field]; 749 759 else 750 760 $form = '%s'; 751 761 $bits[] = "`$field` = {$form}"; … … 755 765 foreach ( (array) array_keys($where) as $field ) { 756 766 if ( !empty($where_format) ) 757 767 $form = ( $form = array_shift($where_formats) ) ? $form : $where_format[0]; 758 elseif ( isset($ db_field_types[$field]) )759 $form = $ db_field_types[$field];768 elseif ( isset($this->field_types[$field]) ) 769 $form = $this->field_types[$field]; 760 770 else 761 771 $form = '%s'; 762 772 $wheres[] = "$field = {$form}"; -
wp-settings.php
247 247 require (ABSPATH . WPINC . '/functions.php'); 248 248 require (ABSPATH . WPINC . '/classes.php'); 249 249 250 require_wp_db(); 251 252 if ( !empty($wpdb->error) ) 253 dead_db(); 254 250 255 /** 251 256 * Format specifiers for DB columns. Columns not listed here default to %s. 252 257 * @since 2.8.0 258 * @see wpdb:$field_types 259 * @see wpdb:prepare() 260 * @see wpdb:insert() 261 * @see wpdb:update() 253 262 */ 254 $ db_field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d',263 $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d', 255 264 'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'commment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d', 256 265 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d', 257 266 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d'); 258 267 259 require_wp_db();260 261 if ( !empty($wpdb->error) )262 dead_db();263 264 268 $prefix = $wpdb->set_prefix($table_prefix); 265 269 266 270 if ( is_wp_error($prefix) )