When upgrading to 4.2.1, delete suspicious comments.

git-svn-id: https://develop.svn.wordpress.org/trunk@32308 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2015-04-27 16:03:48 +00:00
parent 0152b8f49b
commit 0224286861
2 changed files with 31 additions and 1 deletions

View File

@ -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.
*

View File

@ -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