Make WordPress Core


Ignore:
Timestamp:
07/01/2015 03:38:09 PM (11 years ago)
Author:
obenland
Message:

Improve the tone of key/salts recommendation message.

Also adds some inline comments to make it easier to understand how it
is determined whether to show the message or not.

Props helen.
Fixes #20779.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/maint/repair.php

    r32830 r33026  
    3636        foreach ( array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT' ) as $key ) {
    3737                if ( defined( $key ) ) {
     38                        // Check for unique values of each key.
    3839                        $duplicated_keys[ constant( $key ) ] = isset( $duplicated_keys[ constant( $key ) ] );
    3940                } else {
     41                        // If a constant is not defined, it's missing.
    4042                        $missing_key = true;
    4143                }
    4244        }
    4345
     46        // If at least one key uses the default value, consider it duplicated.
    4447        if ( isset( $duplicated_keys[ $default_key ] ) ) {
    4548                $duplicated_keys[ $default_key ] = true;
    4649        }
     50
     51        // Weed out all unique, non-default values.
    4752        $duplicated_keys = array_filter( $duplicated_keys );
    4853
    4954        if ( $duplicated_keys || $missing_key ) {
    5055                // Translators: 1: wp-config.php; 2: Secret key service URL.
    51                 echo '<p>' . sprintf( __( 'While you are in your %1$s file, you should also make sure you have the 8 unique phrases in place. 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>';
     56                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>';
    5257        }
    5358
Note: See TracChangeset for help on using the changeset viewer.