Ticket #18770: 18770.patch
File 18770.patch, 3.7 KB (added by , 13 years ago) |
---|
-
wp-admin/maint/repair.php
21 21 if ( !defined('WP_ALLOW_REPAIR') ) { 22 22 echo '<p>'.__('To allow use of this page to automatically repair database problems, please add the following line to your wp-config.php file. Once this line is added to your config, reload this page.')."</p><code>define('WP_ALLOW_REPAIR', true);</code>"; 23 23 } elseif ( isset($_GET['repair']) ) { 24 $problems = array();25 24 check_admin_referer('repair_db'); 26 25 27 26 if ( 2 == $_GET['repair'] ) … … 30 29 $optimize = false; 31 30 32 31 $okay = true; 32 $problems = array(); 33 33 34 34 $tables = $wpdb->tables(); 35 35 36 // Sitecategories may not exist if global terms are disabled. 36 37 if ( is_multisite() && ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->sitecategories'" ) ) 37 38 unset( $tables['sitecategories'] ); 39 38 40 $tables = array_merge( $tables, (array) apply_filters( 'tables_to_repair', array() ) ); // Return tables with table prefixes. 41 39 42 // Loop over the tables, checking and repairing as needed. 40 43 foreach ( $tables as $table ) { 41 44 $check = $wpdb->get_row("CHECK TABLE $table"); 45 46 echo '<p>'; 42 47 if ( 'OK' == $check->Msg_text ) { 43 echo "<p>The $table table is okay."; 48 /* translators: %s: table name */ 49 printf( __( 'The %s table is okay.' ), $table ); 44 50 } else { 45 echo "<p>The $table table is not okay. It is reporting the following error: <code>$check->Msg_text</code>. WordPress will attempt to repair this table…"; 51 /* translators: 1: table name, 2: error message, */ 52 printf( __( 'The %1$s table is not okay. It is reporting the following error: %2$s. WordPress will attempt to repair this table…' ) , $table, "<code>$check->Msg_text</code>" ); 53 46 54 $repair = $wpdb->get_row("REPAIR TABLE $table"); 55 56 echo '<br /> '; 47 57 if ( 'OK' == $check->Msg_text ) { 48 echo "<br /> Successfully repaired the $table table."; 58 /* translators: %s: table name */ 59 printf( __( 'Successfully repaired the %s table.' ), $table ); 49 60 } else { 50 echo "<br /> Failed to repair the $table table. Error: $check->Msg_text<br />"; 51 $problems["$table"] = $check->Msg_text; 61 /* translators: 1: table name, 2: error message, */ 62 echo sprintf( __( 'Failed to repair the %1$s table. Error: %2$s' ), $table, "<code>$check->Msg_text</code>" ) . '<br />'; 63 $problems[$table] = $check->Msg_text; 52 64 $okay = false; 53 65 } 54 66 } 67 55 68 if ( $okay && $optimize ) { 56 69 $check = $wpdb->get_row("ANALYZE TABLE $table"); 70 71 echo '<br />  '; 57 72 if ( 'Table is already up to date' == $check->Msg_text ) { 58 echo "<br /> The $table table is already optimized."; 73 /* translators: %s: table name */ 74 printf( __( 'The %s table is already optimized.' ), $table ); 59 75 } else { 60 76 $check = $wpdb->get_row("OPTIMIZE TABLE $table"); 61 if ( 'OK' == $check->Msg_text || 'Table is already up to date' == $check->Msg_text ) 62 echo "<br /> Successfully optimized the $table table."; 63 else 64 echo "<br /> Failed to optimize the $table table. Error: $check->Msg_text"; 77 78 echo '<br />  '; 79 if ( 'OK' == $check->Msg_text || 'Table is already up to date' == $check->Msg_text ) { 80 /* translators: %s: table name */ 81 printf( __( 'Successfully optimized the $table table.' ), $table ); 82 } else { 83 /* translators: 1: table name, 2: error message, */ 84 printf( __( 'Failed to optimize the $table table. Error: $check->Msg_text' ), $table,"<code>$check->Msg_text</code>" ); 85 } 65 86 } 66 87 } 67 88 echo '</p>';