Make WordPress Core


Ignore:
Timestamp:
06/30/2020 11:03:57 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Comments: Introduce wp_update_comment_type_batch_size filter for the comment batch size in _wp_batch_update_comment_type().

Follow-up to [47597].

Props dchymko.
Fixes #50513. See #49236.

File:
1 edited

Legend:

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

    r48218 r48225  
    38323832    wp_schedule_single_event( time() + ( 2 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' );
    38333833
    3834     // Update the `comment_type` field value to be `comment` for the next 100 rows of comments.
     3834    /**
     3835     * Filters the comment batch size for updating the comment type.
     3836     *
     3837     * @since 5.5.0
     3838     *
     3839     * @param int $comment_batch_size The comment batch size. Default 100.
     3840     */
     3841    $comment_batch_size = (int) apply_filters( 'wp_update_comment_type_batch_size', 100 );
     3842
     3843    // Update the `comment_type` field value to be `comment` for the next batch of comments.
    38353844    $wpdb->query(
    3836         "UPDATE {$wpdb->comments}
    3837         SET comment_type = 'comment'
    3838         WHERE comment_type = ''
    3839         ORDER BY comment_ID DESC
    3840         LIMIT 100"
     3845        $wpdb->prepare(
     3846            "UPDATE {$wpdb->comments}
     3847            SET comment_type = 'comment'
     3848            WHERE comment_type = ''
     3849            ORDER BY comment_ID DESC
     3850            LIMIT %d"
     3851        ),
     3852        $comment_batch_size
    38413853    );
    38423854
Note: See TracChangeset for help on using the changeset viewer.