Make WordPress Core


Ignore:
Timestamp:
09/19/2019 10:06:41 PM (5 years ago)
Author:
whyisjake
Message:

Multisite: Remove the redundant blog_versions table.

As part of the Multisite installation process, a blog_versions table is created. This table is never read from (except immediately prior to updating it), it's only ever inserted into or updated. It is not used to determine which blogs need to be upgraded.
This table was introduced in 3.0 when the WPMU schema was merged #11644 and it appears the table has never been used in core and is therefore redundant and may as well be removed.

Props johnbillion, nacin, ryan, johnjamesjacoby, whyisjake.

Fixes #19755. See #41685.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r46193 r46194  
    651651
    652652        if ( is_multisite() ) {
    653             $site_id = get_current_blog_id();
    654 
    655             if ( $wpdb->get_row( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->blog_versions} WHERE blog_id = %d", $site_id ) ) ) {
    656                 $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->blog_versions} SET db_version = %d WHERE blog_id = %d", $wp_db_version, $site_id ) );
    657             } else {
    658                 $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->blog_versions} ( `blog_id` , `db_version` , `last_updated` ) VALUES ( %d, %d, NOW() );", $site_id, $wp_db_version ) );
    659             }
    660653            update_site_meta( get_current_blog_id(), 'db_version', $wp_db_version );
    661654            update_site_meta( get_current_blog_id(), 'db_last_updated', microtime() );
Note: See TracChangeset for help on using the changeset viewer.