X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/61343b82c4f0da4c68e4c6373daafff4a81efdd1..9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f:/wp-admin/maint/repair.php?ds=sidebyside diff --git a/wp-admin/maint/repair.php b/wp-admin/maint/repair.php index 7cc13e11..cdc6c0aa 100644 --- a/wp-admin/maint/repair.php +++ b/wp-admin/maint/repair.php @@ -7,13 +7,14 @@ */ define('WP_REPAIRING', true); -require_once('../../wp-load.php'); +require_once( dirname( dirname( dirname( __FILE__ ) ) ) . '/wp-load.php' ); header( 'Content-Type: text/html; charset=utf-8' ); ?> > + <?php _e( 'WordPress › Database Repair' ); ?> -

+

' . __( '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.' ) . "

define('WP_ALLOW_REPAIR', true);"; + echo '

' . __( '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.' ) . "

define('WP_ALLOW_REPAIR', true);

"; } elseif ( isset( $_GET['repair'] ) ) { $optimize = 2 == $_GET['repair']; $okay = true; @@ -35,10 +36,19 @@ if ( ! defined( 'WP_ALLOW_REPAIR' ) ) { $tables = $wpdb->tables(); // Sitecategories may not exist if global terms are disabled. - if ( is_multisite() && ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->sitecategories'" ) ) + $query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->sitecategories ) ); + if ( is_multisite() && ! $wpdb->get_var( $query ) ) { unset( $tables['sitecategories'] ); + } - $tables = array_merge( $tables, (array) apply_filters( 'tables_to_repair', array() ) ); // Return tables with table prefixes. + /** + * Filter additional database tables to repair. + * + * @since 3.0.0 + * + * @param array $tables Array of prefixed table names to be repaired. + */ + $tables = array_merge( $tables, (array) apply_filters( 'tables_to_repair', array() ) ); // Loop over the tables, checking and repairing as needed. foreach ( $tables as $table ) { @@ -90,13 +100,13 @@ if ( ! defined( 'WP_ALLOW_REPAIR' ) ) { } if ( $problems ) { - printf( '

' . __('Some database problems could not be repaired. Please copy-and-paste the following list of errors to the WordPress support forums to get additional assistance.') . '

', __( 'http://wordpress.org/support/forum/how-to-and-troubleshooting' ) ); + printf( '

' . __('Some database problems could not be repaired. Please copy-and-paste the following list of errors to the WordPress support forums to get additional assistance.') . '

', __( 'https://wordpress.org/support/forum/how-to-and-troubleshooting' ) ); $problem_output = ''; foreach ( $problems as $table => $problem ) $problem_output .= "$table: $problem\n"; echo '

'; } else { - echo '

' . __( 'Repairs complete. Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users.' ) . "

define('WP_ALLOW_REPAIR', true);"; + echo '

' . __( 'Repairs complete. Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users.' ) . "

define('WP_ALLOW_REPAIR', true);

"; } } else { if ( isset( $_GET['referrer'] ) && 'is_blog_installed' == $_GET['referrer'] )