Make WordPress Core


Ignore:
Timestamp:
04/27/2015 05:12:56 PM (11 years ago)
Author:
pento
Message:

4.1: When upgrading, remove any suspicious comments.

File:
1 edited

Legend:

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

    r30742 r32312  
    442442    if ( $wp_current_db_version < 29630 )
    443443        upgrade_400();
     444
     445    if ( $wp_current_db_version < 30134 )
     446        upgrade_414();
    444447
    445448    maybe_disable_link_manager();
     
    13301333
    13311334/**
     1335 * Execute changes made in WordPress 4.1.4.
     1336 *
     1337 * @since 4.1.3
     1338 */
     1339function upgrade_414() {
     1340    global $wp_current_db_version, $wpdb;
     1341
     1342    if ( $wp_current_db_version < 30134 ) {
     1343        $content_length = $wpdb->get_col_length( $wpdb->comments, 'comment_content' );
     1344        if ( ! $content_length ) {
     1345            $content_length = 65535;
     1346        }
     1347
     1348        $comments = $wpdb->get_results(
     1349            "SELECT comment_ID FROM $wpdb->comments
     1350            WHERE comment_date_gmt > '2015-04-26'
     1351            AND CHAR_LENGTH( comment_content ) >= $content_length
     1352            AND ( comment_content LIKE '%<%' OR comment_content LIKE '%>%' )"
     1353        );
     1354
     1355        foreach ( $comments as $comment ) {
     1356            wp_delete_comment( $comment->comment_ID, true );
     1357        }
     1358    }
     1359}
     1360
     1361/**
    13321362 * Execute network level changes
    13331363 *
Note: See TracChangeset for help on using the changeset viewer.