mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-25 13:52:59 +02:00
Remove no longer needed DB has_cap() checks. Props filosofo. fixes #11443
git-svn-id: http://svn.automattic.com/wordpress/trunk@12409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6ae74dfd09
commit
60c67e593c
@ -19,12 +19,10 @@ $charset_collate = '';
|
|||||||
// Declare these as global in case schema.php is included from a function.
|
// Declare these as global in case schema.php is included from a function.
|
||||||
global $wpdb, $wp_queries;
|
global $wpdb, $wp_queries;
|
||||||
|
|
||||||
if ( $wpdb->has_cap( 'collation' ) ) {
|
if ( ! empty($wpdb->charset) )
|
||||||
if ( ! empty($wpdb->charset) )
|
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
||||||
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
if ( ! empty($wpdb->collate) )
|
||||||
if ( ! empty($wpdb->collate) )
|
$charset_collate .= " COLLATE $wpdb->collate";
|
||||||
$charset_collate .= " COLLATE $wpdb->collate";
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Create WordPress database tables SQL */
|
/** Create WordPress database tables SQL */
|
||||||
$wp_queries = "CREATE TABLE $wpdb->terms (
|
$wp_queries = "CREATE TABLE $wpdb->terms (
|
||||||
|
@ -1784,14 +1784,8 @@ class WP_Query {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($q['category__not_in']) ) {
|
if ( !empty($q['category__not_in']) ) {
|
||||||
if ( $wpdb->has_cap( 'subqueries' ) ) {
|
$cat_string = "'" . implode("', '", $q['category__not_in']) . "'";
|
||||||
$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) )";
|
||||||
$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) . "')";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Category stuff for nice URLs
|
// Category stuff for nice URLs
|
||||||
@ -1874,14 +1868,8 @@ class WP_Query {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($q['tag__not_in']) ) {
|
if ( !empty($q['tag__not_in']) ) {
|
||||||
if ( $wpdb->has_cap( 'subqueries' ) ) {
|
$tag_string = "'" . implode("', '", $q['tag__not_in']) . "'";
|
||||||
$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) )";
|
||||||
$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 and slug intersections.
|
// Tag and slug intersections.
|
||||||
|
@ -385,17 +385,15 @@ class wpdb {
|
|||||||
|
|
||||||
$this->ready = true;
|
$this->ready = true;
|
||||||
|
|
||||||
if ( $this->has_cap( 'collation' ) ) {
|
if ( !empty($this->charset) ) {
|
||||||
if ( !empty($this->charset) ) {
|
if ( function_exists('mysql_set_charset') ) {
|
||||||
if ( function_exists('mysql_set_charset') ) {
|
mysql_set_charset($this->charset, $this->dbh);
|
||||||
mysql_set_charset($this->charset, $this->dbh);
|
$this->real_escape = true;
|
||||||
$this->real_escape = true;
|
} else {
|
||||||
} else {
|
$collation_query = "SET NAMES '{$this->charset}'";
|
||||||
$collation_query = "SET NAMES '{$this->charset}'";
|
if ( !empty($this->collate) )
|
||||||
if ( !empty($this->collate) )
|
$collation_query .= " COLLATE '{$this->collate}'";
|
||||||
$collation_query .= " COLLATE '{$this->collate}'";
|
$this->query($collation_query);
|
||||||
$this->query($collation_query);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user