Changeset 13229 for trunk/wp-admin/maint/repair.php
- Timestamp:
- 02/19/2010 07:57:03 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/maint/repair.php
r13224 r13229 32 32 $okay = true; 33 33 34 $tables = array_merge( $wpdb->tables, is_multisite() ? $wpdb->global_tables : array( 'users', 'usermeta' ) ); 35 $prefix = $wpdb->prefix; 36 if ( is_multisite() && ! defined('MULTISITE') ) // _1 to get MU-era main blog 37 $prefix .= '_1'; 38 34 $tables = $wpdb->tables( 'all', true ); 39 35 // Loop over the WP tables, checking and repairing as needed. 40 36 foreach ( $tables as $table ) { 41 if ( in_array( $table, $wpdb->old_tables ) ) 42 continue; 43 44 $check = $wpdb->get_row("CHECK TABLE {$prefix}$table"); 37 $check = $wpdb->get_row("CHECK TABLE $table"); 45 38 if ( 'OK' == $check->Msg_text ) { 46 echo "<p>The {$prefix}$table table is okay.";39 echo "<p>The $table table is okay."; 47 40 } else { 48 echo "<p>The {$prefix}$table table is not okay. It is reporting the following error: <code>$check->Msg_text</code>. WordPress will attempt to repair this table…";49 $repair = $wpdb->get_row("REPAIR TABLE {$prefix}$table");41 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…"; 42 $repair = $wpdb->get_row("REPAIR TABLE $table"); 50 43 if ( 'OK' == $check->Msg_text ) { 51 echo "<br /> Successfully repaired the {$prefix}$table table.";44 echo "<br /> Successfully repaired the $table table."; 52 45 } else { 53 echo "<br /> Failed to repair the {prefix}$table table. Error: $check->Msg_text<br />";54 $problems[" {$prefix}$table"] = $check->Msg_text;46 echo "<br /> Failed to repair the $table table. Error: $check->Msg_text<br />"; 47 $problems["$table"] = $check->Msg_text; 55 48 $okay = false; 56 49 } 57 50 } 58 51 if ( $okay && $optimize ) { 59 $check = $wpdb->get_row("ANALYZE TABLE {$prefix}$table");52 $check = $wpdb->get_row("ANALYZE TABLE $table"); 60 53 if ( 'Table is already up to date' == $check->Msg_text ) { 61 echo "<br /> The {$prefix}$table table is already optimized.";54 echo "<br /> The $table table is already optimized."; 62 55 } else { 63 $check = $wpdb->get_row("OPTIMIZE TABLE {$prefix}$table");56 $check = $wpdb->get_row("OPTIMIZE TABLE $table"); 64 57 if ( 'OK' == $check->Msg_text || 'Table is already up to date' == $check->Msg_text ) 65 echo "<br /> Successfully optimized the {$prefix}$table table.";58 echo "<br /> Successfully optimized the $table table."; 66 59 else 67 echo "<br /> Failed to optimize the {$prefix}$table table. Error: $check->Msg_text";60 echo "<br /> Failed to optimize the $table table. Error: $check->Msg_text"; 68 61 } 69 62 }
Note: See TracChangeset
for help on using the changeset viewer.