Database: Check the correct value for displaying the "Successfully repaired table" or "Failed to repair" messages on Database Repair screen.

Additionally, rename the variables holding the results of `ANALYZE TABLE` and `OPTIMIZE TABLE` requests, for clarity.

Props mehrshaddarzi.
Fixes #51932.
Built from https://develop.svn.wordpress.org/trunk@49750


git-svn-id: http://core.svn.wordpress.org/trunk@49473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-12-04 15:50:12 +00:00
parent 692c6498e9
commit e7b601f7c5
2 changed files with 9 additions and 9 deletions

View File

@ -106,34 +106,34 @@ if ( ! defined( 'WP_ALLOW_REPAIR' ) || ! WP_ALLOW_REPAIR ) {
$repair = $wpdb->get_row( "REPAIR TABLE $table" ); $repair = $wpdb->get_row( "REPAIR TABLE $table" );
echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;'; echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
if ( 'OK' === $check->Msg_text ) { if ( 'OK' === $repair->Msg_text ) {
/* translators: %s: Table name. */ /* translators: %s: Table name. */
printf( __( 'Successfully repaired the %s table.' ), "<code>$table</code>" ); printf( __( 'Successfully repaired the %s table.' ), "<code>$table</code>" );
} else { } else {
/* translators: 1: Table name, 2: Error message. */ /* translators: 1: Table name, 2: Error message. */
printf( __( 'Failed to repair the %1$s table. Error: %2$s' ), "<code>$table</code>", "<code>$check->Msg_text</code>" ) . '<br />'; printf( __( 'Failed to repair the %1$s table. Error: %2$s' ), "<code>$table</code>", "<code>$repair->Msg_text</code>" ) . '<br />';
$problems[ $table ] = $check->Msg_text; $problems[ $table ] = $repair->Msg_text;
$okay = false; $okay = false;
} }
} }
if ( $okay && $optimize ) { if ( $okay && $optimize ) {
$check = $wpdb->get_row( "ANALYZE TABLE $table" ); $analyze = $wpdb->get_row( "ANALYZE TABLE $table" );
echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;'; echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
if ( 'Table is already up to date' === $check->Msg_text ) { if ( 'Table is already up to date' === $analyze->Msg_text ) {
/* translators: %s: Table name. */ /* translators: %s: Table name. */
printf( __( 'The %s table is already optimized.' ), "<code>$table</code>" ); printf( __( 'The %s table is already optimized.' ), "<code>$table</code>" );
} else { } else {
$check = $wpdb->get_row( "OPTIMIZE TABLE $table" ); $optimize = $wpdb->get_row( "OPTIMIZE TABLE $table" );
echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;'; echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
if ( 'OK' === $check->Msg_text || 'Table is already up to date' === $check->Msg_text ) { if ( 'OK' === $optimize->Msg_text || 'Table is already up to date' === $optimize->Msg_text ) {
/* translators: %s: Table name. */ /* translators: %s: Table name. */
printf( __( 'Successfully optimized the %s table.' ), "<code>$table</code>" ); printf( __( 'Successfully optimized the %s table.' ), "<code>$table</code>" );
} else { } else {
/* translators: 1: Table name. 2: Error message. */ /* translators: 1: Table name. 2: Error message. */
printf( __( 'Failed to optimize the %1$s table. Error: %2$s' ), "<code>$table</code>", "<code>$check->Msg_text</code>" ); printf( __( 'Failed to optimize the %1$s table. Error: %2$s' ), "<code>$table</code>", "<code>$optimize->Msg_text</code>" );
} }
} }
} }

View File

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