Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-admin/maint
File: repair.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Database Repair and Optimization Script.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Database
[5] Fix | Delete
*/
[6] Fix | Delete
define( 'WP_REPAIRING', true );
[7] Fix | Delete
[8] Fix | Delete
require_once dirname( __DIR__, 2 ) . '/wp-load.php';
[9] Fix | Delete
[10] Fix | Delete
header( 'Content-Type: text/html; charset=utf-8' );
[11] Fix | Delete
?>
[12] Fix | Delete
<!DOCTYPE html>
[13] Fix | Delete
<html <?php language_attributes(); ?>>
[14] Fix | Delete
<head>
[15] Fix | Delete
<meta name="viewport" content="width=device-width" />
[16] Fix | Delete
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
[17] Fix | Delete
<meta name="robots" content="noindex,nofollow" />
[18] Fix | Delete
<title><?php _e( 'WordPress &rsaquo; Database Repair' ); ?></title>
[19] Fix | Delete
<?php wp_admin_css( 'install', true ); ?>
[20] Fix | Delete
</head>
[21] Fix | Delete
<body class="wp-core-ui">
[22] Fix | Delete
<p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>"><?php _e( 'WordPress' ); ?></a></p>
[23] Fix | Delete
[24] Fix | Delete
<?php
[25] Fix | Delete
[26] Fix | Delete
if ( ! defined( 'WP_ALLOW_REPAIR' ) || ! WP_ALLOW_REPAIR ) {
[27] Fix | Delete
[28] Fix | Delete
echo '<h1 class="screen-reader-text">' .
[29] Fix | Delete
/* translators: Hidden accessibility text. */
[30] Fix | Delete
__( 'Allow automatic database repair' ) .
[31] Fix | Delete
'</h1>';
[32] Fix | Delete
[33] Fix | Delete
echo '<p>';
[34] Fix | Delete
printf(
[35] Fix | Delete
/* translators: %s: wp-config.php */
[36] Fix | Delete
__( 'To allow use of this page to automatically repair database problems, please add the following line to your %s file. Once this line is added to your config, reload this page.' ),
[37] Fix | Delete
'<code>wp-config.php</code>'
[38] Fix | Delete
);
[39] Fix | Delete
echo "</p><p><code>define('WP_ALLOW_REPAIR', true);</code></p>";
[40] Fix | Delete
[41] Fix | Delete
$default_keys = array_unique(
[42] Fix | Delete
array(
[43] Fix | Delete
'put your unique phrase here',
[44] Fix | Delete
/*
[45] Fix | Delete
* translators: This string should only be translated if wp-config-sample.php is localized.
[46] Fix | Delete
* You can check the localized release package or
[47] Fix | Delete
* https://i18n.svn.wordpress.org/<locale code>/branches/<wp version>/dist/wp-config-sample.php
[48] Fix | Delete
*/
[49] Fix | Delete
__( 'put your unique phrase here' ),
[50] Fix | Delete
)
[51] Fix | Delete
);
[52] Fix | Delete
$missing_key = false;
[53] Fix | Delete
$duplicated_keys = array();
[54] Fix | Delete
[55] Fix | Delete
foreach ( array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT' ) as $key ) {
[56] Fix | Delete
if ( defined( $key ) ) {
[57] Fix | Delete
// Check for unique values of each key.
[58] Fix | Delete
$duplicated_keys[ constant( $key ) ] = isset( $duplicated_keys[ constant( $key ) ] );
[59] Fix | Delete
} else {
[60] Fix | Delete
// If a constant is not defined, it's missing.
[61] Fix | Delete
$missing_key = true;
[62] Fix | Delete
}
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
// If at least one key uses a default value, consider it duplicated.
[66] Fix | Delete
foreach ( $default_keys as $default_key ) {
[67] Fix | Delete
if ( isset( $duplicated_keys[ $default_key ] ) ) {
[68] Fix | Delete
$duplicated_keys[ $default_key ] = true;
[69] Fix | Delete
}
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
// Weed out all unique, non-default values.
[73] Fix | Delete
$duplicated_keys = array_filter( $duplicated_keys );
[74] Fix | Delete
[75] Fix | Delete
if ( $duplicated_keys || $missing_key ) {
[76] Fix | Delete
[77] Fix | Delete
echo '<h2 class="screen-reader-text">' .
[78] Fix | Delete
/* translators: Hidden accessibility text. */
[79] Fix | Delete
__( 'Check secret keys' ) .
[80] Fix | Delete
'</h2>';
[81] Fix | Delete
[82] Fix | Delete
/* translators: 1: wp-config.php, 2: Secret key service URL. */
[83] Fix | Delete
echo '<p>' . sprintf( __( 'While you are editing your %1$s file, take a moment to make sure you have all 8 keys and that they are unique. You can generate these using the <a href="%2$s">WordPress.org secret key service</a>.' ), '<code>wp-config.php</code>', 'https://api.wordpress.org/secret-key/1.1/salt/' ) . '</p>';
[84] Fix | Delete
}
[85] Fix | Delete
} elseif ( isset( $_GET['repair'] ) ) {
[86] Fix | Delete
[87] Fix | Delete
echo '<h1 class="screen-reader-text">' .
[88] Fix | Delete
/* translators: Hidden accessibility text. */
[89] Fix | Delete
__( 'Database repair results' ) .
[90] Fix | Delete
'</h1>';
[91] Fix | Delete
[92] Fix | Delete
$optimize = '2' === $_GET['repair'];
[93] Fix | Delete
$okay = true;
[94] Fix | Delete
$problems = array();
[95] Fix | Delete
[96] Fix | Delete
$tables = $wpdb->tables();
[97] Fix | Delete
[98] Fix | Delete
/**
[99] Fix | Delete
* Filters additional database tables to repair.
[100] Fix | Delete
*
[101] Fix | Delete
* @since 3.0.0
[102] Fix | Delete
*
[103] Fix | Delete
* @param string[] $tables Array of prefixed table names to be repaired.
[104] Fix | Delete
*/
[105] Fix | Delete
$tables = array_merge( $tables, (array) apply_filters( 'tables_to_repair', array() ) );
[106] Fix | Delete
[107] Fix | Delete
// Loop over the tables, checking and repairing as needed.
[108] Fix | Delete
foreach ( $tables as $table ) {
[109] Fix | Delete
$check = $wpdb->get_row( "CHECK TABLE $table" );
[110] Fix | Delete
[111] Fix | Delete
echo '<p>';
[112] Fix | Delete
if ( 'OK' === $check->Msg_text ) {
[113] Fix | Delete
/* translators: %s: Table name. */
[114] Fix | Delete
printf( __( 'The %s table is okay.' ), "<code>$table</code>" );
[115] Fix | Delete
} else {
[116] Fix | Delete
/* translators: 1: Table name, 2: Error message. */
[117] Fix | Delete
printf( __( 'The %1$s table is not okay. It is reporting the following error: %2$s. WordPress will attempt to repair this table&hellip;' ), "<code>$table</code>", "<code>$check->Msg_text</code>" );
[118] Fix | Delete
[119] Fix | Delete
$repair = $wpdb->get_row( "REPAIR TABLE $table" );
[120] Fix | Delete
[121] Fix | Delete
echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
[122] Fix | Delete
if ( 'OK' === $repair->Msg_text ) {
[123] Fix | Delete
/* translators: %s: Table name. */
[124] Fix | Delete
printf( __( 'Successfully repaired the %s table.' ), "<code>$table</code>" );
[125] Fix | Delete
} else {
[126] Fix | Delete
/* translators: 1: Table name, 2: Error message. */
[127] Fix | Delete
printf( __( 'Failed to repair the %1$s table. Error: %2$s' ), "<code>$table</code>", "<code>$repair->Msg_text</code>" ) . '<br />';
[128] Fix | Delete
$problems[ $table ] = $repair->Msg_text;
[129] Fix | Delete
$okay = false;
[130] Fix | Delete
}
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
if ( $okay && $optimize ) {
[134] Fix | Delete
$analyze = $wpdb->get_row( "ANALYZE TABLE $table" );
[135] Fix | Delete
[136] Fix | Delete
echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
[137] Fix | Delete
if ( 'Table is already up to date' === $analyze->Msg_text ) {
[138] Fix | Delete
/* translators: %s: Table name. */
[139] Fix | Delete
printf( __( 'The %s table is already optimized.' ), "<code>$table</code>" );
[140] Fix | Delete
} else {
[141] Fix | Delete
$optimize = $wpdb->get_row( "OPTIMIZE TABLE $table" );
[142] Fix | Delete
[143] Fix | Delete
echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
[144] Fix | Delete
if ( 'OK' === $optimize->Msg_text || 'Table is already up to date' === $optimize->Msg_text ) {
[145] Fix | Delete
/* translators: %s: Table name. */
[146] Fix | Delete
printf( __( 'Successfully optimized the %s table.' ), "<code>$table</code>" );
[147] Fix | Delete
} else {
[148] Fix | Delete
/* translators: 1: Table name. 2: Error message. */
[149] Fix | Delete
printf( __( 'Failed to optimize the %1$s table. Error: %2$s' ), "<code>$table</code>", "<code>$optimize->Msg_text</code>" );
[150] Fix | Delete
}
[151] Fix | Delete
}
[152] Fix | Delete
}
[153] Fix | Delete
echo '</p>';
[154] Fix | Delete
}
[155] Fix | Delete
[156] Fix | Delete
if ( $problems ) {
[157] Fix | Delete
printf(
[158] Fix | Delete
/* translators: %s: URL to "Fixing WordPress" forum. */
[159] Fix | Delete
'<p>' . __( 'Some database problems could not be repaired. Please copy-and-paste the following list of errors to the <a href="%s">WordPress support forums</a> to get additional assistance.' ) . '</p>',
[160] Fix | Delete
__( 'https://wordpress.org/support/forum/how-to-and-troubleshooting' )
[161] Fix | Delete
);
[162] Fix | Delete
$problem_output = '';
[163] Fix | Delete
foreach ( $problems as $table => $problem ) {
[164] Fix | Delete
$problem_output .= "$table: $problem\n";
[165] Fix | Delete
}
[166] Fix | Delete
echo '<p><textarea name="errors" id="errors" rows="20" cols="60">' . esc_textarea( $problem_output ) . '</textarea></p>';
[167] Fix | Delete
} else {
[168] Fix | Delete
echo '<p>' . __( 'Repairs complete. Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users.' ) . "</p><p><code>define('WP_ALLOW_REPAIR', true);</code></p>";
[169] Fix | Delete
}
[170] Fix | Delete
} else {
[171] Fix | Delete
[172] Fix | Delete
echo '<h1 class="screen-reader-text">' .
[173] Fix | Delete
/* translators: Hidden accessibility text. */
[174] Fix | Delete
__( 'WordPress database repair' ) .
[175] Fix | Delete
'</h1>';
[176] Fix | Delete
[177] Fix | Delete
if ( isset( $_GET['referrer'] ) && 'is_blog_installed' === $_GET['referrer'] ) {
[178] Fix | Delete
echo '<p>' . __( 'One or more database tables are unavailable. To allow WordPress to attempt to repair these tables, press the &#8220;Repair Database&#8221; button. Repairing can take a while, so please be patient.' ) . '</p>';
[179] Fix | Delete
} else {
[180] Fix | Delete
echo '<p>' . __( 'WordPress can automatically look for some common database problems and repair them. Repairing can take a while, so please be patient.' ) . '</p>';
[181] Fix | Delete
}
[182] Fix | Delete
?>
[183] Fix | Delete
<p class="step"><a class="button button-large" href="repair.php?repair=1"><?php _e( 'Repair Database' ); ?></a></p>
[184] Fix | Delete
<p><?php _e( 'WordPress can also attempt to optimize the database. This improves performance in some situations. Repairing and optimizing the database can take a long time and the database will be locked while optimizing.' ); ?></p>
[185] Fix | Delete
<p class="step"><a class="button button-large" href="repair.php?repair=2"><?php _e( 'Repair and Optimize Database' ); ?></a></p>
[186] Fix | Delete
<?php
[187] Fix | Delete
}
[188] Fix | Delete
?>
[189] Fix | Delete
</body>
[190] Fix | Delete
</html>
[191] Fix | Delete
[192] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function