Skip to content

Commit a7c429c

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@39532 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 93a5849 commit a7c429c

1 file changed

Lines changed: 1 addition & 22 deletions

File tree

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

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -946,33 +946,12 @@ protected function fill_descendants( $comments ) {
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

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.
978957
$child_ids = $uncached_parent_ids = array();

0 commit comments

Comments
 (0)