Upgrade/Install: Indicate use of MyISAM storage engine in upgrade check.
In MySQL 5.5.5, the default storage engine was changed from `MyISAM` to `InnoDB`. While still available, usage of `MyISAM` has been discouraged since and is considered legacy due to the lack of support for more modern feature. The percentage of WordPress sites with `MyISAM` tables in the wild is currently unknown. This change adds a field to upgrade checks that includes a list of tables using `MyISAM` to help make more informed decisions about database features in the future. Props johnjamesjacoby, johnbillion, dd32, desrosj, mukesh27. Fixes #63640. Built from https://develop.svn.wordpress.org/trunk@61001 git-svn-id: http://core.svn.wordpress.org/trunk@60337 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -106,6 +106,7 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) {
|
||||
'users' => get_user_count(),
|
||||
'multisite_enabled' => $multisite_enabled,
|
||||
'initial_db_version' => get_site_option( 'initial_db_version' ),
|
||||
'myisam_tables' => array(),
|
||||
'extensions' => array_combine( $extensions, array_map( 'phpversion', $extensions ) ),
|
||||
'platform_flags' => array(
|
||||
'os' => PHP_OS,
|
||||
@@ -114,6 +115,39 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) {
|
||||
'image_support' => array(),
|
||||
);
|
||||
|
||||
// Check for default tables using the MyISAM engine.
|
||||
$table_names = implode( "','", $wpdb->tables() );
|
||||
$myisam_tables = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- This query cannot use interpolation.
|
||||
"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = %s AND TABLE_NAME IN ('$table_names') AND ENGINE = %s;",
|
||||
DB_NAME,
|
||||
'MyISAM'
|
||||
),
|
||||
OBJECT_K
|
||||
);
|
||||
|
||||
if ( ! empty( $myisam_tables ) ) {
|
||||
$all_unprefixed_tables = $wpdb->tables( 'all', false );
|
||||
|
||||
// Including the table prefix is not necessary.
|
||||
$unprefixed_myisam_tables = array_reduce(
|
||||
array_keys( $myisam_tables ),
|
||||
function ( $carry, $prefixed_myisam_table ) use ( $all_unprefixed_tables ) {
|
||||
foreach ( $all_unprefixed_tables as $unprefixed ) {
|
||||
if ( str_ends_with( $prefixed_myisam_table, $unprefixed ) ) {
|
||||
$carry[] = $unprefixed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $carry;
|
||||
},
|
||||
array()
|
||||
);
|
||||
|
||||
$query['myisam_tables'] = $unprefixed_myisam_tables;
|
||||
}
|
||||
|
||||
if ( function_exists( 'gd_info' ) ) {
|
||||
$gd_info = gd_info();
|
||||
// Filter to supported values.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.9-alpha-61000';
|
||||
$wp_version = '6.9-alpha-61001';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user