Make WordPress Core

Changeset 39532


Ignore:
Timestamp:
12/07/2016 03:51:08 PM (8 years ago)
Author:
boonebgorges
Message:

Comments: Clean up unused code after [38446].

When the direct SQL query was removed in [38446], part of the SQL
concatenation was not removed. This changeset fixes that.

Props david.binda.
Fixes #39142.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-comment-query.php

    r39274 r39532  
    947947        );
    948948
    949         /*
    950          * The WHERE clause for the descendant query is the same as for the top-level
    951          * query, minus the `parent`, `parent__in`, and `parent__not_in` sub-clauses.
    952          */
    953         $_where = $this->filtered_where_clause;
    954         $exclude_keys = array( 'parent', 'parent__in', 'parent__not_in' );
    955         foreach ( $exclude_keys as $exclude_key ) {
    956             if ( isset( $this->sql_clauses['where'][ $exclude_key ] ) ) {
    957                 $clause = $this->sql_clauses['where'][ $exclude_key ];
    958 
    959                 // Strip the clause as well as any adjacent ANDs.
    960                 $pattern = '|(?:AND)?\s*' . $clause . '\s*(?:AND)?|';
    961                 $_where_parts = preg_split( $pattern, $_where );
    962 
    963                 // Remove empties.
    964                 $_where_parts = array_filter( array_map( 'trim', $_where_parts ) );
    965 
    966                 // Reassemble with an AND.
    967                 $_where = implode( ' AND ', $_where_parts );
    968             }
    969         }
    970 
    971949        $key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) );
    972950        $last_changed = wp_cache_get_last_changed( 'comment' );
     
    974952        // Fetch an entire level of the descendant tree at a time.
    975953        $level = 0;
     954        $exclude_keys = array( 'parent', 'parent__in', 'parent__not_in' );
    976955        do {
    977956            // Parent-child relationships may be cached. Only query for those that are not.
Note: See TracChangeset for help on using the changeset viewer.