When upgrading to 4.2.1, delete suspicious comments.

Built from https://develop.svn.wordpress.org/trunk@32308


git-svn-id: http://core.svn.wordpress.org/trunk@32279 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2015-04-27 16:04:25 +00:00
parent 85d327d4bd
commit 51402dc520
2 changed files with 32 additions and 2 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

@ -4,14 +4,14 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-alpha-32306';
$wp_version = '4.3-alpha-32308';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
*
* @global int $wp_db_version
*/
$wp_db_version = 31532;
$wp_db_version = 32308;
/**
* Holds the TinyMCE version