Make WordPress Core


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

3.7:

  • 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.7/src/wp-admin/includes/upgrade.php

    r28077 r32318  
    412412                upgrade_373();
    413413
     414        if ( $wp_current_db_version < 26150 )
     415                upgrade_378();
     416
    414417        maybe_disable_link_manager();
    415418
    … …  
    12661269                        $wpdb->update( $wpdb->posts, array( 'post_status' => 'draft' ), array( 'ID' => $post->ID ) );
    12671270                        clean_post_cache( $post->ID );
     1271                }
     1272        }
     1273}
     1274
     1275/**
     1276 * Execute changes made in WordPress 3.7.8.
     1277 *
     1278 * @since 3.7.8
     1279 */
     1280function upgrade_378() {
     1281        global $wp_current_db_version, $wpdb;
     1282
     1283        if ( $wp_current_db_version < 26150 ) {
     1284                $content_length = $wpdb->get_col_length( $wpdb->comments, 'comment_content' );
     1285                if ( ! $content_length ) {
     1286                        $content_length = 65535;
     1287                }
     1288
     1289                $comments = $wpdb->get_results(
     1290                        "SELECT comment_ID FROM $wpdb->comments
     1291                        WHERE comment_date_gmt > '2015-04-26'
     1292                        AND CHAR_LENGTH( comment_content ) >= $content_length
     1293                        AND ( comment_content LIKE '%<%' OR comment_content LIKE '%>%' )"
     1294                );
     1295
     1296                foreach ( $comments as $comment ) {
     1297                        wp_delete_comment( $comment->comment_ID, true );
    12681298                }
    12691299        }
Note: See TracChangeset for help on using the changeset viewer.