Esempio n. 1
0
/**
 * Execute changes made in WordPress 4.3.0.
 *
 * @since 4.3.0
 *
 * @global int   $wp_current_db_version
 * @global wpdb  $wpdb
 */
function upgrade_430()
{
    global $wp_current_db_version, $wpdb;
    if ($wp_current_db_version < 32364) {
        $content_length = $wpdb->get_col_length($wpdb->comments, 'comment_content');
        if (is_wp_error($content_length)) {
            return;
        }
        if (false === $content_length) {
            $content_length = array('type' => 'byte', 'length' => 65535);
        } elseif (!is_array($content_length)) {
            $length = (int) $content_length > 0 ? (int) $content_length : 65535;
            $content_length = array('type' => 'byte', 'length' => $length);
        }
        if ('byte' !== $content_length['type'] || 0 === $content_length['length']) {
            // Sites with malformed DB schemas are on their own.
            return;
        }
        $allowed_length = intval($content_length['length']) - 10;
        $comments = $wpdb->get_results("SELECT `comment_ID` FROM `{$wpdb->comments}`\r\n\t\t\t\tWHERE `comment_date_gmt` > '2015-04-26'\r\n\t\t\t\tAND LENGTH( `comment_content` ) >= {$allowed_length}\r\n\t\t\t\tAND ( `comment_content` LIKE '%<%' OR `comment_content` LIKE '%>%' )");
        foreach ($comments as $comment) {
            wp_delete_comment($comment->comment_ID, true);
        }
    }
    if ($wp_current_db_version < 32814) {
        split_all_shared_terms();
    }
}
Esempio n. 2
0
/**
 * Execute changes made in WordPress 4.3.0.
 *
 * @since 4.3.0
 *
 * @global int   $wp_current_db_version
 * @global wpdb  $wpdb
 */
function upgrade_430()
{
    global $wp_current_db_version, $wpdb;
    if ($wp_current_db_version < 32364) {
        upgrade_430_fix_comments();
    }
    if ($wp_current_db_version < 32814) {
        split_all_shared_terms();
    }
}
Esempio n. 3
0
/**
 * Execute changes made in WordPress 4.3.0.
 *
 * @since 4.3.0
 *
 * @global int   $wp_current_db_version
 * @global wpdb  $wpdb
 */
function upgrade_430()
{
    global $wp_current_db_version, $wpdb;
    if ($wp_current_db_version < 32364) {
        upgrade_430_fix_comments();
    }
    if ($wp_current_db_version < 32814) {
        split_all_shared_terms();
    }
    if ($wp_current_db_version < 33055 && 'utf8mb4' === $wpdb->charset) {
        if (is_multisite()) {
            $tables = $wpdb->tables('blog');
        } else {
            $tables = $wpdb->tables('all');
            if (!wp_should_upgrade_global_tables()) {
                $global_tables = $wpdb->tables('global');
                $tables = array_diff_assoc($tables, $global_tables);
            }
        }
        foreach ($tables as $table) {
            maybe_convert_table_to_utf8mb4($table);
        }
    }
}