diff --git a/wp-includes/update.php b/wp-includes/update.php index 867ead3cdd..4ab8f5a4e4 100644 --- a/wp-includes/update.php +++ b/wp-includes/update.php @@ -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. diff --git a/wp-includes/version.php b/wp-includes/version.php index e174e60023..bed110092f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.