WordPress.org

Make WordPress Core

Ticket #31072: 31072.patch

File 31072.patch, 1.2 KB (added by rodrigosprimo, 4 years ago)

Add an index to wp_comments comment_type field

  • src/wp-admin/includes/schema.php

    diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php
    index 83ba531..508d8f6 100644
    a b CREATE TABLE $wpdb->comments ( 
    118118  KEY comment_approved_date_gmt (comment_approved,comment_date_gmt),
    119119  KEY comment_date_gmt (comment_date_gmt),
    120120  KEY comment_parent (comment_parent),
    121   KEY comment_author_email (comment_author_email(10))
     121  KEY comment_author_email (comment_author_email(10)),
     122  KEY comment_type (comment_type)
    122123) $charset_collate;
    123124CREATE TABLE $wpdb->links (
    124125  link_id bigint(20) unsigned NOT NULL auto_increment,
  • src/wp-admin/includes/upgrade.php

    diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php
    index 807673a..0b0b5fb 100644
    a b function pre_schema_upgrade() { 
    28552855                        maybe_convert_table_to_utf8mb4( $wpdb->termmeta );
    28562856                }
    28572857        }
     2858
     2859        // Upgrade versions prior to 4.7
     2860        if ( $wp_current_db_version < 37966 ) {
     2861                // Add index to wp_comments comment_type field
     2862                $wpdb->query( "ALTER TABLE {$wpdb->comments} DROP INDEX comment_type, ADD INDEX comment_type (comment_type)" );
     2863        }
    28582864}
    28592865
    28602866/**