WordPress.org

Make WordPress Core

Ticket #49236: 49236.patch

File 49236.patch, 7.5 KB (added by imath, 8 months ago)
  • src/wp-admin/includes/ajax-actions.php

    diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
    index d1700d9fa0..be84ed707b 100644
    function wp_ajax_replyto_comment( $action ) { 
    12801280                $comment_author_email = wp_slash( $user->user_email );
    12811281                $comment_author_url   = wp_slash( $user->user_url );
    12821282                $comment_content      = trim( $_POST['content'] );
    1283                 $comment_type         = isset( $_POST['comment_type'] ) ? trim( $_POST['comment_type'] ) : '';
     1283                $comment_type         = isset( $_POST['comment_type'] ) ? trim( $_POST['comment_type'] ) : 'comment';
    12841284
    12851285                if ( current_user_can( 'unfiltered_html' ) ) {
    12861286                        if ( ! isset( $_POST['_wp_unfiltered_html_comment'] ) ) {
  • src/wp-admin/includes/schema.php

    diff --git src/wp-admin/includes/schema.php src/wp-admin/includes/schema.php
    index a2e8216457..b6bea35526 100644
    CREATE TABLE $wpdb->comments ( 
    111111        comment_karma int(11) NOT NULL default '0',
    112112        comment_approved varchar(20) NOT NULL default '1',
    113113        comment_agent varchar(255) NOT NULL default '',
    114         comment_type varchar(20) NOT NULL default '',
     114        comment_type varchar(20) NOT NULL default 'comment',
    115115        comment_parent bigint(20) unsigned NOT NULL default '0',
    116116        user_id bigint(20) unsigned NOT NULL default '0',
    117117        PRIMARY KEY  (comment_ID),
  • src/wp-admin/includes/upgrade.php

    diff --git src/wp-admin/includes/upgrade.php src/wp-admin/includes/upgrade.php
    index 505b0aad17..672bf1928d 100644
    Commenter avatars come from <a href="https://gravatar.com">Gravatar</a>.' 
    283283                                'comment_date'         => $now,
    284284                                'comment_date_gmt'     => $now_gmt,
    285285                                'comment_content'      => $first_comment,
     286                                'comment_type'         => 'comment',
    286287                        )
    287288                );
    288289
    function upgrade_all() { 
    833834                upgrade_530();
    834835        }
    835836
     837        if ( $wp_current_db_version < 47086 ) {
     838                upgrade_540();
     839        }
     840
    836841        maybe_disable_link_manager();
    837842
    838843        maybe_disable_automattic_widgets();
    function upgrade_530() { 
    21482153        }
    21492154}
    21502155
     2156/**
     2157 * Executes changes made in WordPress 5.4.0
     2158 *
     2159 * @ignore
     2160 * @since 5.4.0
     2161 */
     2162function upgrade_540() {
     2163        global $wpdb;
     2164
     2165        // Update the `comment_type` field value to be `comment` for the rows about comments.
     2166        $wpdb->update( $wpdb->comments, array( 'comment_type' => 'comment' ), array( 'comment_type' => '' ) );
     2167}
     2168
    21512169/**
    21522170 * Executes network-level upgrade routines.
    21532171 *
  • src/wp-content/themes/twentyten/functions.php

    diff --git src/wp-content/themes/twentyten/functions.php src/wp-content/themes/twentyten/functions.php
    index 97f018d4ab..6ffbfc16bd 100644
    if ( ! function_exists( 'twentyten_comment' ) ) : 
    418418                $GLOBALS['comment'] = $comment;
    419419                switch ( $comment->comment_type ) :
    420420                        case '':
     421                        case 'comment':
    421422                                ?>
    422423                <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
    423424                <div id="comment-<?php comment_ID(); ?>">
  • src/wp-includes/class-wp-comment-query.php

    diff --git src/wp-includes/class-wp-comment-query.php src/wp-includes/class-wp-comment-query.php
    index 9038b6194b..2cb8fc4044 100644
    class WP_Comment_Query { 
    741741
    742742                                        case 'comment':
    743743                                        case 'comments':
    744                                                 $comment_types[ $operator ][] = "''";
     744                                                $comment_types[ $operator ][] = "'comment'";
    745745                                                break;
    746746
    747747                                        case 'pings':
  • src/wp-includes/class-wp-comment.php

    diff --git src/wp-includes/class-wp-comment.php src/wp-includes/class-wp-comment.php
    index 70d7db2bd8..9b3b57e206 100644
    final class WP_Comment { 
    116116         * @since 4.4.0
    117117         * @var string
    118118         */
    119         public $comment_type = '';
     119        public $comment_type = 'comment';
    120120
    121121        /**
    122122         * Parent comment ID.
  • src/wp-includes/comment.php

    diff --git src/wp-includes/comment.php src/wp-includes/comment.php
    index fca5ab9db4..53c7dcf483 100644
    function wp_insert_comment( $commentdata ) { 
    19011901        $comment_karma    = ! isset( $data['comment_karma'] ) ? 0 : $data['comment_karma'];
    19021902        $comment_approved = ! isset( $data['comment_approved'] ) ? 1 : $data['comment_approved'];
    19031903        $comment_agent    = ! isset( $data['comment_agent'] ) ? '' : $data['comment_agent'];
    1904         $comment_type     = ! isset( $data['comment_type'] ) ? '' : $data['comment_type'];
     1904        $comment_type     = ! isset( $data['comment_type'] ) ? 'comment' : $data['comment_type'];
    19051905        $comment_parent   = ! isset( $data['comment_parent'] ) ? 0 : $data['comment_parent'];
    19061906
    19071907        $user_id = ! isset( $data['user_id'] ) ? 0 : $data['user_id'];
    function wp_throttle_comment_flood( $block, $time_lastcomment, $time_newcomment 
    20572057 *     @type string $comment_author_email The comment author email address.
    20582058 *     @type string $comment_author_url   The comment author URL.
    20592059 *     @type string $comment_content      The content of the comment.
     2060 *     @type string $comment_type         The name of the comment type.
    20602061 *     @type string $comment_date         The date the comment was submitted. Default is the current time.
    20612062 *     @type string $comment_date_gmt     The date the comment was submitted in the GMT timezone.
    20622063 *                                        Default is `$comment_date` in the GMT timezone.
    function wp_new_comment( $commentdata, $avoid_die = false ) { 
    21222123                $commentdata['comment_date_gmt'] = current_time( 'mysql', 1 );
    21232124        }
    21242125
     2126        if ( empty( $commentdata['comment_type'] ) ) {
     2127                $commentdata['comment_type'] = 'comment';
     2128        }
     2129
    21252130        $commentdata = wp_filter_comment( $commentdata );
    21262131
    21272132        $commentdata['comment_approved'] = wp_allow_comment( $commentdata, $avoid_die );
    function wp_handle_comment_submission( $comment_data ) { 
    33423347                }
    33433348        }
    33443349
    3345         $comment_type = '';
     3350        $comment_type = 'comment';
    33463351
    33473352        if ( get_option( 'require_name_email' ) && ! $user->exists() ) {
    33483353                if ( '' == $comment_author_email || '' == $comment_author ) {
  • src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    index e05f9802ea..1533def2f2 100644
    class WP_REST_Comments_Controller extends WP_REST_Controller { 
    507507                        return $prepared_comment;
    508508                }
    509509
    510                 $prepared_comment['comment_type'] = '';
     510                $prepared_comment['comment_type'] = 'comment';
    511511
    512512                /*
    513513                 * Do not allow a comment to be created with missing or empty
  • src/wp-includes/version.php

    diff --git src/wp-includes/version.php src/wp-includes/version.php
    index b3deb5ad92..e1b1bb19a7 100644
    $wp_version = '5.4-alpha-46582-src'; 
    2020 *
    2121 * @global int $wp_db_version
    2222 */
    23 $wp_db_version = 47018;
     23$wp_db_version = 47086;
    2424
    2525/**
    2626 * Holds the TinyMCE version
  • tests/phpunit/tests/comment-submission.php

    diff --git tests/phpunit/tests/comment-submission.php tests/phpunit/tests/comment-submission.php
    index 2d288b3e85..377ad959a4 100644
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    742742                                'comment_author_email' => $user->user_email,
    743743                                'comment_author_url'   => $user->user_url,
    744744                                'comment_content'      => $data['comment'],
    745                                 'comment_type'         => '',
     745                                'comment_type'         => 'comment',
    746746                                'comment_parent'       => '0',
    747747                                'user_ID'              => $user->ID,
    748748                                'user_id'              => $user->ID,