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.


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


git-svn-id: http://core.svn.wordpress.org/trunk@46006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
whyisjake 2019-09-19 22:07:57 +00:00
parent 250eb42802
commit a014bd21c1
4 changed files with 1 additions and 24 deletions

View File

@ -261,13 +261,6 @@ CREATE TABLE $wpdb->posts (
KEY domain (domain(50),path(5)),
KEY lang_id (lang_id)
) $charset_collate;
CREATE TABLE $wpdb->blog_versions (
blog_id bigint(20) NOT NULL default '0',
db_version varchar(20) NOT NULL default '',
last_updated datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (blog_id),
KEY db_version (db_version)
) $charset_collate;
CREATE TABLE $wpdb->blogmeta (
meta_id bigint(20) unsigned NOT NULL auto_increment,
blog_id bigint(20) NOT NULL default '0',

View File

@ -650,13 +650,6 @@ if ( ! function_exists( 'wp_upgrade' ) ) :
wp_cache_flush();
if ( is_multisite() ) {
$site_id = get_current_blog_id();
if ( $wpdb->get_row( $wpdb->prepare( "SELECT blog_id FROM {$wpdb->blog_versions} WHERE blog_id = %d", $site_id ) ) ) {
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->blog_versions} SET db_version = %d WHERE blog_id = %d", $wp_db_version, $site_id ) );
} else {
$wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->blog_versions} ( `blog_id` , `db_version` , `last_updated` ) VALUES ( %d, %d, NOW() );", $site_id, $wp_db_version ) );
}
update_site_meta( get_current_blog_id(), 'db_version', $wp_db_version );
update_site_meta( get_current_blog_id(), 'db_last_updated', microtime() );
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-46193';
$wp_version = '5.3-alpha-46194';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -306,7 +306,6 @@ class wpdb {
'sitemeta',
'sitecategories',
'registration_log',
'blog_versions',
);
/**
@ -425,14 +424,6 @@ class wpdb {
*/
public $blogmeta;
/**
* Multisite Blog Versions table
*
* @since 3.0.0
* @var string
*/
public $blog_versions;
/**
* Multisite Registration Log table
*