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