Changeset 12409
- Timestamp:
- 12/15/2009 09:01:57 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/schema.php
r12405 r12409 20 20 global $wpdb, $wp_queries; 21 21 22 if ( $wpdb->has_cap( 'collation' ) ) { 23 if ( ! empty($wpdb->charset) ) 24 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 25 if ( ! empty($wpdb->collate) ) 26 $charset_collate .= " COLLATE $wpdb->collate"; 27 } 22 if ( ! empty($wpdb->charset) ) 23 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 24 if ( ! empty($wpdb->collate) ) 25 $charset_collate .= " COLLATE $wpdb->collate"; 28 26 29 27 /** Create WordPress database tables SQL */ -
trunk/wp-includes/query.php
r12393 r12409 1785 1785 1786 1786 if ( !empty($q['category__not_in']) ) { 1787 if ( $wpdb->has_cap( 'subqueries' ) ) { 1788 $cat_string = "'" . implode("', '", $q['category__not_in']) . "'"; 1789 $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tt.term_id IN ($cat_string) )"; 1790 } else { 1791 $ids = get_objects_in_term($q['category__not_in'], 'category'); 1792 if ( !is_wp_error($ids) && is_array($ids) && count($ids) > 0 ) 1793 $whichcat .= " AND $wpdb->posts.ID NOT IN ('" . implode("', '", $ids) . "')"; 1794 } 1787 $cat_string = "'" . implode("', '", $q['category__not_in']) . "'"; 1788 $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'category' AND tt.term_id IN ($cat_string) )"; 1795 1789 } 1796 1790 … … 1875 1869 1876 1870 if ( !empty($q['tag__not_in']) ) { 1877 if ( $wpdb->has_cap( 'subqueries' ) ) { 1878 $tag_string = "'" . implode("', '", $q['tag__not_in']) . "'"; 1879 $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'post_tag' AND tt.term_id IN ($tag_string) )"; 1880 } else { 1881 $ids = get_objects_in_term($q['tag__not_in'], 'post_tag'); 1882 if ( !is_wp_error($ids) && is_array($ids) && count($ids) > 0 ) 1883 $whichcat .= " AND $wpdb->posts.ID NOT IN ('" . implode("', '", $ids) . "')"; 1884 } 1871 $tag_string = "'" . implode("', '", $q['tag__not_in']) . "'"; 1872 $whichcat .= " AND $wpdb->posts.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = 'post_tag' AND tt.term_id IN ($tag_string) )"; 1885 1873 } 1886 1874 -
trunk/wp-includes/wp-db.php
r12404 r12409 386 386 $this->ready = true; 387 387 388 if ( $this->has_cap( 'collation' ) ) { 389 if ( !empty($this->charset) ) { 390 if ( function_exists('mysql_set_charset') ) { 391 mysql_set_charset($this->charset, $this->dbh); 392 $this->real_escape = true; 393 } else { 394 $collation_query = "SET NAMES '{$this->charset}'"; 395 if ( !empty($this->collate) ) 396 $collation_query .= " COLLATE '{$this->collate}'"; 397 $this->query($collation_query); 398 } 388 if ( !empty($this->charset) ) { 389 if ( function_exists('mysql_set_charset') ) { 390 mysql_set_charset($this->charset, $this->dbh); 391 $this->real_escape = true; 392 } else { 393 $collation_query = "SET NAMES '{$this->charset}'"; 394 if ( !empty($this->collate) ) 395 $collation_query .= " COLLATE '{$this->collate}'"; 396 $this->query($collation_query); 399 397 } 400 398 }
Note: See TracChangeset
for help on using the changeset viewer.