Make WordPress Core

Ticket #20779: 20779.1.patch

File 20779.1.patch, 1.6 KB (added by chriscct7, 9 years ago)
  • wp-admin/maint/repair.php

     
    2828
    2929if ( ! defined( 'WP_ALLOW_REPAIR' ) ) {
    3030        echo '<p>' . __( 'To allow use of this page to automatically repair database problems, please add the following line to your <code>wp-config.php</code> file. Once this line is added to your config, reload this page.' ) . "</p><p><code>define('WP_ALLOW_REPAIR', true);</code></p>";
     31        $default_key = 'put your unique phrase here';
     32        $missing_key = false;
     33        $duplicated_keys = array();
     34       
     35        foreach ( array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT' ) as $key ) {
     36                if ( defined( $key ) ) {
     37                        $duplicated_keys[ constant( $key ) ] = isset( $duplicated_keys[ constant( $key ) ] );
     38                } else {
     39                        $missing_key = true;
     40                }
     41        }
     42       
     43        if ( isset( $duplicated_keys[ $default_key ] ) ) {
     44                $duplicated_keys[ $default_key ] = true;
     45        }
     46        $duplicated_keys = array_filter( $duplicated_keys );
     47       
     48        if ( $duplicated_keys || $missing_key ) {
     49                echo '<p>' . sprintf( __( 'While you are in your <code>wp-config.php</code> file, you should also make sure you have the 8 unique phrases in place. You can generate these using the <a href="%s">WordPress.org secret key service</a>.' ), 'https://api.wordpress.org/secret-key/1.1/salt/' ) . '</p>';
     50        }
     51       
    3152} elseif ( isset( $_GET['repair'] ) ) {
    3253        $optimize = 2 == $_GET['repair'];
    3354        $okay = true;