Make WordPress Core

Ticket #39142: 39142.patch

File 39142.patch, 1.8 KB (added by david.binda, 9 years ago)

Removing the $_where variable and moving $exclude_keys to inside conditional where it is used.

  • wp-includes/class-wp-comment-query.php

     
    946946                        0 => wp_list_pluck( $comments, 'comment_ID' ),
    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' );
    973951
     
    990968                        if ( $uncached_parent_ids ) {
    991969                                // Fetch this level of comments.
    992970                                $parent_query_args = $this->query_vars;
     971                                /*
     972                                 * The params for the descendant query is the same as for the top-level
     973                                 * query, minus the `parent`, `parent__in`, and `parent__not_in` sub-clauses.
     974                                 */
     975                                $exclude_keys = array( 'parent', 'parent__in', 'parent__not_in' );
    993976                                foreach ( $exclude_keys as $exclude_key ) {
    994977                                        $parent_query_args[ $exclude_key ] = '';
    995978                                }