Make WordPress Core

Changeset 48752

Timestamp:
08/07/2020 04:33:39 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Comments: Update comment cache in the upgrade routine for changing the comment_type DB field value in comments table.

This ensures that comment object cache is cleared after changing the comment type to comment instead of an empty string.

Add a unit test for _wp_batch_update_comment_type().

Follow-up to [47597], [47626], [48225], [48227].

Props imath, westonruter.
Reviewed by desrosj, SergeyBiryukov.
Merges [48748] and [48751] to the 5.5 branch.
Fixes #49236.

Location:
branches/5.5
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/5.5

  • branches/5.5/src/wp-admin/includes/upgrade.php

    r48582 r48752  
    21752175
    21762176    if ( $wp_current_db_version < 48121 ) {
    2177         update_option( 'finished_updating_comment_type', 0 );
    2178         wp_schedule_single_event( time() + ( 1 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' );
    2179 
    21802177        $comment_previously_approved = get_option( 'comment_whitelist', '' );
    21812178        update_option( 'comment_previously_approved', $comment_previously_approved );
     
    21982195        delete_option( 'blacklist_keys' );
    21992196        delete_option( 'blocklist_keys' );
     2197
     2198
     2199
     2200
     2201
    22002202    }
    22012203}
  • branches/5.5/src/wp-includes/comment.php

    r48658 r48752  
    38403840    $comment_batch_size = (int) apply_filters( 'wp_update_comment_type_batch_size', 100 );
    38413841
    3842     // Update the `comment_type` field value to be `comment` for the next batch of comments.
    3843     $wpdb->query(
     3842    // .
     3843    $(
    38443844        $wpdb->prepare(
    3845             "UPDATE {$wpdb->comments}
    3846             SET comment_type = 'comment'
     3845            "
     3846           
    38473847            WHERE comment_type = ''
    38483848            ORDER BY comment_ID DESC
     
    38523852    );
    38533853
     3854
     3855
     3856
     3857
     3858
     3859
     3860
     3861
     3862
     3863
     3864
     3865
     3866
     3867
     3868
    38543869    delete_option( $lock_name );
    38553870}
  • branches/5.5/src/wp-includes/version.php

    r48739 r48752  
    2121 * @global int $wp_db_version
    2222 */
    23 $wp_db_version = 48575;
     23$wp_db_version = 48;
    2424
    2525/**
Note: See TracChangeset for help on using the changeset viewer.