Make WordPress Core


Ignore:
Timestamp:
04/17/2020 07:33:52 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Comments: Use comment instead of an empty string for the comment_type DB field value in comments table.

This is the first step to bring support for custom comment types into WordPress.

Add a scheduled upgrade routine to update the type value for existing comments, in batches of 100 at a time.

Props imath, aaroncampbell, jeremyfelt, dshanske.
Fixes #49236.

File:
1 edited

Legend:

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

    r47550 r47597  
    284284                'comment_date_gmt'     => $now_gmt,
    285285                'comment_content'      => $first_comment,
     286                'comment_type'         => 'comment',
    286287            )
    287288        );
     
    835836    }
    836837
     838    if ( $wp_current_db_version < 47597 ) {
     839        upgrade_550();
     840    }
     841
    837842    maybe_disable_link_manager();
    838843
     
    21562161
    21572162/**
     2163 * Executes changes made in WordPress 5.5.0.
     2164 *
     2165 * @ignore
     2166 * @since 5.5.0
     2167 */
     2168function upgrade_550() {
     2169    update_option( 'finished_updating_comment_type', 0 );
     2170    wp_schedule_single_event( time() + ( 1 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' );
     2171}
     2172
     2173/**
    21582174 * Executes network-level upgrade routines.
    21592175 *
Note: See TracChangeset for help on using the changeset viewer.