From 8e0d091c55655dccd67348506b40316788fac15f Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 15 Dec 2009 21:01:57 +0000 Subject: [PATCH] Remove no longer needed DB has_cap() checks. Props filosofo. fixes #11443 git-svn-id: https://develop.svn.wordpress.org/trunk@12409 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/schema.php | 10 ++++------ wp-includes/query.php | 20 ++++---------------- wp-includes/wp-db.php | 20 +++++++++----------- 3 files changed, 17 insertions(+), 33 deletions(-) diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index bebbb0a818..0c4a9c9a6d 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -19,12 +19,10 @@ $charset_collate = ''; // Declare these as global in case schema.php is included from a function. global $wpdb, $wp_queries; -if ( $wpdb->has_cap( 'collation' ) ) { - if ( ! empty($wpdb->charset) ) - $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; - if ( ! empty($wpdb->collate) ) - $charset_collate .= " COLLATE $wpdb->collate"; -} +if ( ! empty($wpdb->charset) ) + $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; +if ( ! empty($wpdb->collate) ) + $charset_collate .= " COLLATE $wpdb->collate"; /** Create WordPress database tables SQL */ $wp_queries = "CREATE TABLE $wpdb->terms ( diff --git a/wp-includes/query.php b/wp-includes/query.php index ea3e680fc2..88440cba9f 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -1784,14 +1784,8 @@ class WP_Query { } if ( !empty($q['category__not_in']) ) { - if ( $wpdb->has_cap( 'subqueries' ) ) { - $cat_string = "'" . implode("', '", $q['category__not_in']) . "'"; - $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) )"; - } else { - $ids = get_objects_in_term($q['category__not_in'], 'category'); - if ( !is_wp_error($ids) && is_array($ids) && count($ids) > 0 ) - $whichcat .= " AND $wpdb->posts.ID NOT IN ('" . implode("', '", $ids) . "')"; - } + $cat_string = "'" . implode("', '", $q['category__not_in']) . "'"; + $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) )"; } // Category stuff for nice URLs @@ -1874,14 +1868,8 @@ class WP_Query { } if ( !empty($q['tag__not_in']) ) { - if ( $wpdb->has_cap( 'subqueries' ) ) { - $tag_string = "'" . implode("', '", $q['tag__not_in']) . "'"; - $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) )"; - } else { - $ids = get_objects_in_term($q['tag__not_in'], 'post_tag'); - if ( !is_wp_error($ids) && is_array($ids) && count($ids) > 0 ) - $whichcat .= " AND $wpdb->posts.ID NOT IN ('" . implode("', '", $ids) . "')"; - } + $tag_string = "'" . implode("', '", $q['tag__not_in']) . "'"; + $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) )"; } // Tag and slug intersections. diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 596e41234d..4be33a5954 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -385,17 +385,15 @@ class wpdb { $this->ready = true; - if ( $this->has_cap( 'collation' ) ) { - if ( !empty($this->charset) ) { - if ( function_exists('mysql_set_charset') ) { - mysql_set_charset($this->charset, $this->dbh); - $this->real_escape = true; - } else { - $collation_query = "SET NAMES '{$this->charset}'"; - if ( !empty($this->collate) ) - $collation_query .= " COLLATE '{$this->collate}'"; - $this->query($collation_query); - } + if ( !empty($this->charset) ) { + if ( function_exists('mysql_set_charset') ) { + mysql_set_charset($this->charset, $this->dbh); + $this->real_escape = true; + } else { + $collation_query = "SET NAMES '{$this->charset}'"; + if ( !empty($this->collate) ) + $collation_query .= " COLLATE '{$this->collate}'"; + $this->query($collation_query); } }