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. Built from https://develop.svn.wordpress.org/trunk@48225 git-svn-id: http://core.svn.wordpress.org/trunk@47994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0249959306
commit
18c5348b2f
|
@ -3831,13 +3831,25 @@ function _wp_batch_update_comment_type() {
|
||||||
// Empty comment type found? We'll need to run this script again.
|
// Empty comment type found? We'll need to run this script again.
|
||||||
wp_schedule_single_event( time() + ( 2 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' );
|
wp_schedule_single_event( time() + ( 2 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' );
|
||||||
|
|
||||||
// Update the `comment_type` field value to be `comment` for the next 100 rows of comments.
|
/**
|
||||||
|
* Filters the comment batch size for updating the comment type.
|
||||||
|
*
|
||||||
|
* @since 5.5.0
|
||||||
|
*
|
||||||
|
* @param int $comment_batch_size The comment batch size. Default 100.
|
||||||
|
*/
|
||||||
|
$comment_batch_size = (int) apply_filters( 'wp_update_comment_type_batch_size', 100 );
|
||||||
|
|
||||||
|
// Update the `comment_type` field value to be `comment` for the next batch of comments.
|
||||||
$wpdb->query(
|
$wpdb->query(
|
||||||
"UPDATE {$wpdb->comments}
|
$wpdb->prepare(
|
||||||
SET comment_type = 'comment'
|
"UPDATE {$wpdb->comments}
|
||||||
WHERE comment_type = ''
|
SET comment_type = 'comment'
|
||||||
ORDER BY comment_ID DESC
|
WHERE comment_type = ''
|
||||||
LIMIT 100"
|
ORDER BY comment_ID DESC
|
||||||
|
LIMIT %d"
|
||||||
|
),
|
||||||
|
$comment_batch_size
|
||||||
);
|
);
|
||||||
|
|
||||||
delete_option( $lock_name );
|
delete_option( $lock_name );
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.5-alpha-48224';
|
$wp_version = '5.5-alpha-48225';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue