From 02242868618f2eed46bc29a3b23d8f1f419639ab Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 27 Apr 2015 16:03:48 +0000 Subject: [PATCH] When upgrading to 4.2.1, delete suspicious comments. git-svn-id: https://develop.svn.wordpress.org/trunk@32308 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/upgrade.php | 30 ++++++++++++++++++++++++++++++ src/wp-includes/version.php | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index b1c4bc28fa..9fd944a097 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -527,6 +527,9 @@ function upgrade_all() { if ( $wp_current_db_version < 31351 ) upgrade_420(); + if ( $wp_current_db_version < 32308 ) + upgrade_421(); + maybe_disable_link_manager(); maybe_disable_automattic_widgets(); @@ -1435,6 +1438,33 @@ function upgrade_420() { } } +/** + * Execute changes made in WordPress 4.2.1. + * + * @since 4.2.1 + */ +function upgrade_421() { + global $wp_current_db_version, $wpdb; + + if ( $wp_current_db_version < 32308 ) { + $content_length = $wpdb->get_col_length( $wpdb->comments, 'comment_content' ); + if ( ! $content_length ) { + $content_length = 65535; + } + + $comments = $wpdb->get_results( + "SELECT comment_ID FROM $wpdb->comments + WHERE comment_date_gmt > '2015-04-26' + AND CHAR_LENGTH( comment_content ) >= $content_length + AND ( comment_content LIKE '%<%' OR comment_content LIKE '%>%' )" + ); + + foreach ( $comments as $comment ) { + wp_delete_comment( $comments->comment_ID ); + } + } +} + /** * Executes network-level upgrade routines. * diff --git a/src/wp-includes/version.php b/src/wp-includes/version.php index 50bc84abb9..ff960d7b73 100644 --- a/src/wp-includes/version.php +++ b/src/wp-includes/version.php @@ -11,7 +11,7 @@ $wp_version = '4.3-alpha-32280-src'; * * @global int $wp_db_version */ -$wp_db_version = 31532; +$wp_db_version = 32308; /** * Holds the TinyMCE version