Make WordPress Core

Ticket #55463: 55463.diff

File 55463.diff, 4.3 KB (added by elifvish, 2 years ago)
  • src/wp-includes/comment.php

    diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
    index c2892f16b1..39fc293e5e 100644
    a b function _prime_comment_caches( $comment_ids, $update_meta_cache = true ) { 
    32813281
    32823282        $non_cached_ids = _get_non_cached_ids( $comment_ids, 'comment' );
    32833283        if ( ! empty( $non_cached_ids ) ) {
    3284                 $fresh_comments = $wpdb->get_results( sprintf( "SELECT $wpdb->comments.* FROM $wpdb->comments WHERE comment_ID IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) );
     3284                $fresh_comments = $wpdb->get_results( sprintf( "SELECT $wpdb->comments.* FROM $wpdb->comments WHERE comment_ID IN (%s) LIMIT %d", implode( ',', array_map( 'intval', $non_cached_ids ) ), count( $non_cached_ids ) ) );
    32853285
    32863286                update_comment_cache( $fresh_comments, $update_meta_cache );
    32873287        }
  • src/wp-includes/ms-network.php

    diff --git a/src/wp-includes/ms-network.php b/src/wp-includes/ms-network.php
    index 91001ab9a0..20e44f9523 100644
    a b function _prime_network_caches( $network_ids ) { 
    131131
    132132        $non_cached_ids = _get_non_cached_ids( $network_ids, 'networks' );
    133133        if ( ! empty( $non_cached_ids ) ) {
    134                 $fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
     134                $fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s) LIMIT %d", implode( ',', array_map( 'intval', $non_cached_ids ) ), count( $non_cached_ids ) ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
    135135
    136136                update_network_cache( $fresh_networks );
    137137        }
  • src/wp-includes/ms-site.php

    diff --git a/src/wp-includes/ms-site.php b/src/wp-includes/ms-site.php
    index 2c8c93cb86..2b2f5d60c4 100644
    a b function _prime_site_caches( $ids, $update_meta_cache = true ) { 
    352352
    353353        $non_cached_ids = _get_non_cached_ids( $ids, 'sites' );
    354354        if ( ! empty( $non_cached_ids ) ) {
    355                 $fresh_sites = $wpdb->get_results( sprintf( "SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
     355                $fresh_sites = $wpdb->get_results( sprintf( "SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s) LIMIT %d", implode( ',', array_map( 'intval', $non_cached_ids ) ), count( $non_cached_ids ) ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
    356356
    357357                update_site_cache( $fresh_sites, $update_meta_cache );
    358358        }
  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 91edacf76f..ca42889e57 100644
    a b function _prime_post_caches( $ids, $update_term_cache = true, $update_meta_cache 
    76737673
    76747674        $non_cached_ids = _get_non_cached_ids( $ids, 'posts' );
    76757675        if ( ! empty( $non_cached_ids ) ) {
    7676                 $fresh_posts = $wpdb->get_results( sprintf( "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s)", implode( ',', $non_cached_ids ) ) );
     7676                $fresh_posts = $wpdb->get_results( sprintf( "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s) LIMIT %d", implode( ',', $non_cached_ids ), count( $non_cached_ids ) ) );
    76777677
    76787678                update_post_caches( $fresh_posts, 'any', $update_term_cache, $update_meta_cache );
    76797679        }
  • src/wp-includes/taxonomy.php

    diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
    index 5b1acb4fc6..25201952b0 100644
    a b function _prime_term_caches( $term_ids, $update_meta_cache = true ) { 
    39363936
    39373937        $non_cached_ids = _get_non_cached_ids( $term_ids, 'terms' );
    39383938        if ( ! empty( $non_cached_ids ) ) {
    3939                 $fresh_terms = $wpdb->get_results( sprintf( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) );
     3939                $fresh_terms = $wpdb->get_results( sprintf( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id IN (%s) LIMIT %d", implode( ',', array_map( 'intval', $non_cached_ids ) ), count( $non_cached_ids ) ) );
    39403940
    39413941                update_term_cache( $fresh_terms, $update_meta_cache );
    39423942