Make WordPress Core


Ignore:
Timestamp:
04/27/2015 06:33:43 PM (11 years ago)
Author:
mdawaffe
Message:

3.8:

  • WPDB: Sanity check that any strings being stored in the DB are not too long to store correctly.
  • When upgrading, remove any suspicious comments.
File:
1 edited

Legend:

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

    r28075 r32317  
    415415        upgrade_383();
    416416
     417    if ( $wp_current_db_version < 26693 )
     418        upgrade_388();
     419
    417420    maybe_disable_link_manager();
    418421
     
    12811284            $wpdb->update( $wpdb->posts, array( 'post_status' => 'draft' ), array( 'ID' => $post->ID ) );
    12821285            clean_post_cache( $post->ID );
     1286        }
     1287    }
     1288}
     1289
     1290/**
     1291 * Execute changes made in WordPress 3.8.8.
     1292 *
     1293 * @since 3.8.8
     1294 */
     1295function upgrade_388() {
     1296    global $wp_current_db_version, $wpdb;
     1297
     1298    if ( $wp_current_db_version < 26693 ) {
     1299        $content_length = $wpdb->get_col_length( $wpdb->comments, 'comment_content' );
     1300        if ( ! $content_length ) {
     1301            $content_length = 65535;
     1302        }
     1303
     1304        $comments = $wpdb->get_results(
     1305            "SELECT comment_ID FROM $wpdb->comments
     1306            WHERE comment_date_gmt > '2015-04-26'
     1307            AND CHAR_LENGTH( comment_content ) >= $content_length
     1308            AND ( comment_content LIKE '%<%' OR comment_content LIKE '%>%' )"
     1309        );
     1310
     1311        foreach ( $comments as $comment ) {
     1312            wp_delete_comment( $comment->comment_ID, true );
    12831313        }
    12841314    }
Note: See TracChangeset for help on using the changeset viewer.