Make WordPress Core

Changeset 12409


Ignore:
Timestamp:
12/15/2009 09:01:57 PM (15 years ago)
Author:
ryan
Message:

Remove no longer needed DB has_cap() checks. Props filosofo. fixes #11443

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/schema.php

    r12405 r12409  
    2020global $wpdb, $wp_queries;
    2121
    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 }
     22if ( ! empty($wpdb->charset) )
     23    $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
     24if ( ! empty($wpdb->collate) )
     25    $charset_collate .= " COLLATE $wpdb->collate";
    2826
    2927/** Create WordPress database tables SQL */
  • trunk/wp-includes/query.php

    r12393 r12409  
    17851785
    17861786        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) )";
    17951789        }
    17961790
     
    18751869
    18761870        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) )";
    18851873        }
    18861874
  • trunk/wp-includes/wp-db.php

    r12404 r12409  
    386386        $this->ready = true;
    387387
    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);
    399397            }
    400398        }
Note: See TracChangeset for help on using the changeset viewer.