Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: tables_to_repair

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
29      else
30           $optimize = false;
31
32      $okay = true;
33
34      $tables = $wpdb->tables();
35      // Sitecategories may not exist if global terms are disabled.
36      if ( is_multisite() && ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->sitecategories'" ) )
37           unset( $tables['sitecategories'] );
38      $tables = array_merge( $tables, (array) apply_filters( 'tables_to_repair', array() ) ); // Return tables with table prefixes.
39      // Loop over the tables, checking and repairing as needed.
40      foreach ( $tables as $table ) {
41           $check = $wpdb->get_row("CHECK TABLE $table");
42           if ( 'OK' == $check->Msg_text ) {
43                echo "<p>The $table table is okay.";
44           } 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&hellip;";
46                $repair = $wpdb->get_row("REPAIR TABLE $table");
47                if ( 'OK' == $check->Msg_text ) {