This commit is contained in:
Hanson.xyz Dev
2026-01-04 17:50:08 -06:00
parent 7e45ce0756
commit acc8ac87a0
4131 changed files with 232562 additions and 250244 deletions
+18 -10
View File
@@ -451,8 +451,8 @@ class WP_Comment_Query {
$key = md5( serialize( $_args ) );
$last_changed = wp_cache_get_last_changed( 'comment' );
$cache_key = "get_comments:$key:$last_changed";
$cache_value = wp_cache_get( $cache_key, 'comment-queries' );
$cache_key = "get_comments:$key";
$cache_value = wp_cache_get_salted( $cache_key, 'comment-queries', $last_changed );
if ( false === $cache_value ) {
$comment_ids = $this->get_comment_ids();
if ( $comment_ids ) {
@@ -463,7 +463,7 @@ class WP_Comment_Query {
'comment_ids' => $comment_ids,
'found_comments' => $this->found_comments,
);
wp_cache_add( $cache_key, $cache_value, 'comment-queries' );
wp_cache_set_salted( $cache_key, $cache_value, 'comment-queries', $last_changed );
} else {
$comment_ids = $cache_value['comment_ids'];
$this->found_comments = $cache_value['found_comments'];
@@ -536,6 +536,7 @@ class WP_Comment_Query {
* Used internally to get a list of comment IDs matching the query vars.
*
* @since 4.4.0
* @since 6.9.0 Excludes the 'note' comment type, unless 'all' or the 'note' types are requested.
*
* @global wpdb $wpdb WordPress database abstraction object.
*
@@ -579,9 +580,7 @@ class WP_Comment_Query {
}
}
if ( ! empty( $status_clauses ) ) {
$approved_clauses[] = '( ' . implode( ' OR ', $status_clauses ) . ' )';
}
$approved_clauses[] = '( ' . implode( ' OR ', $status_clauses ) . ' )';
}
// User IDs or emails whose unapproved comments are included, regardless of $status.
@@ -772,6 +771,15 @@ class WP_Comment_Query {
'NOT IN' => (array) $this->query_vars['type__not_in'],
);
// Exclude the 'note' comment type, unless 'all' types or the 'note' type explicitly are requested.
if (
! in_array( 'all', $raw_types['IN'], true ) &&
! in_array( 'note', $raw_types['IN'], true ) &&
! in_array( 'note', $raw_types['NOT IN'], true )
) {
$raw_types['NOT IN'][] = 'note';
}
$comment_types = array();
foreach ( $raw_types as $operator => $_raw_types ) {
$_raw_types = array_unique( $_raw_types );
@@ -1046,9 +1054,9 @@ class WP_Comment_Query {
if ( $_parent_ids ) {
$cache_keys = array();
foreach ( $_parent_ids as $parent_id ) {
$cache_keys[ $parent_id ] = "get_comment_child_ids:$parent_id:$key:$last_changed";
$cache_keys[ $parent_id ] = "get_comment_child_ids:$parent_id:$key";
}
$cache_data = wp_cache_get_multiple( array_values( $cache_keys ), 'comment-queries' );
$cache_data = wp_cache_get_multiple_salted( array_values( $cache_keys ), 'comment-queries', $last_changed );
foreach ( $_parent_ids as $parent_id ) {
$parent_child_ids = $cache_data[ $cache_keys[ $parent_id ] ];
if ( false !== $parent_child_ids ) {
@@ -1082,10 +1090,10 @@ class WP_Comment_Query {
$data = array();
foreach ( $parent_map as $parent_id => $children ) {
$cache_key = "get_comment_child_ids:$parent_id:$key:$last_changed";
$cache_key = "get_comment_child_ids:$parent_id:$key";
$data[ $cache_key ] = $children;
}
wp_cache_set_multiple( $data, 'comment-queries' );
wp_cache_set_multiple_salted( $data, 'comment-queries', $last_changed );
}
++$level;