WordPress.org

Make WordPress Core

Changeset 46194


Ignore:
Timestamp:
09/19/2019 10:06:41 PM (2 months 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.

Location:
trunk/src
Files:
3 edited

Legend:

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

    r45932 r46194  
    262262    KEY lang_id (lang_id)
    263263) $charset_collate;
    264 CREATE TABLE $wpdb->blog_versions (
    265     blog_id bigint(20) NOT NULL default '0',
    266     db_version varchar(20) NOT NULL default '',
    267     last_updated datetime NOT NULL default '0000-00-00 00:00:00',
    268     PRIMARY KEY  (blog_id),
    269     KEY db_version (db_version)
    270 ) $charset_collate;
    271264CREATE TABLE $wpdb->blogmeta (
    272265    meta_id bigint(20) unsigned NOT NULL auto_increment,
  • 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() );
  • trunk/src/wp-includes/wp-db.php

    r45932 r46194  
    307307        'sitecategories',
    308308        'registration_log',
    309         'blog_versions',
    310309    );
    311310
     
    425424     */
    426425    public $blogmeta;
    427 
    428     /**
    429      * Multisite Blog Versions table
    430      *
    431      * @since 3.0.0
    432      * @var string
    433      */
    434     public $blog_versions;
    435426
    436427    /**
Note: See TracChangeset for help on using the changeset viewer.