From 42d83376c98808750bf6b732d3be59c622fe3e93 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 24 Dec 2007 06:34:12 +0000 Subject: [PATCH] Allow DB salt to be overridden by SECRET_SALT. Add a filter to wp_salt(). see #5367 git-svn-id: http://svn.automattic.com/wordpress/trunk@6478 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-config-sample.php | 4 ++-- wp-includes/pluggable.php | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/wp-config-sample.php b/wp-config-sample.php index f46119cdc1..bb7ec33f7f 100644 --- a/wp-config-sample.php +++ b/wp-config-sample.php @@ -9,8 +9,8 @@ define('DB_COLLATE', ''); // Change SECRET_KEY to a unique phrase. You won't have to remember it later, // so make it long and complicated. You can visit https://www.grc.com/passwords.htm -// to get a phrase generated for you. -define('SECRET_KEY', ''); // Change this to a unique phrase. +// to get a phrase generated for you, or just make something up. +define('SECRET_KEY', 'put your unique phrase here'); // Change this to a unique phrase. // You can have multiple installations in one database if you give each a unique prefix $table_prefix = 'wp_'; // Only numbers, letters, and underscores please! diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php index ade158c9ce..cddbe1e967 100644 --- a/wp-includes/pluggable.php +++ b/wp-includes/pluggable.php @@ -700,16 +700,21 @@ endif; if ( !function_exists('wp_salt') ) : function wp_salt() { - if ( defined('SECRET_KEY') && '' != SECRET_KEY ) - return SECRET_KEY; + $secret_key = ''; + if ( defined('SECRET_KEY') && ('' != SECRET_KEY) && ('put your unique phrase here' != SECRET_KEY) ) + $secret_key = SECRET_KEY; - $salt = get_option('secret'); - if ( empty($salt) ) { - $salt = wp_generate_password(); - update_option('secret', $salt); + if ( defined('SECRET_SALT') ) { + $salt = SECRET_SALT; + } else { + $salt = get_option('secret'); + if ( empty($salt) ) { + $salt = wp_generate_password(); + update_option('secret', $salt); + } } - return $salt; + return apply_filters('salt', $salt); } endif;