wp_salt() and more hash work.

git-svn-id: http://svn.automattic.com/wordpress/trunk@3811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2006-05-31 01:40:00 +00:00
parent a50330dd45
commit e38d68adac
2 changed files with 22 additions and 12 deletions

View File

@@ -64,6 +64,7 @@ class WP_Object_Cache {
var $cold_cache_hits = 0;
var $warm_cache_hits = 0;
var $cache_misses = 0;
var $secret = '';
function acquire_lock() {
// Acquire a write lock.
@@ -174,14 +175,10 @@ class WP_Object_Cache {
}
function hash($data) {
global $wp_server_secret;
if ( empty($wp_server_secret) )
$wp_server_secret = DB_PASSWORD;
if ( function_exists('hash_hmac') ) {
return hash_hmac('md5', $data, $wp_server_secret);
return hash_hmac('md5', $data, $this->secret);
} else {
return md5($data . $wp_server_secret);
return md5($data . $this->secret);
}
}
@@ -397,7 +394,7 @@ class WP_Object_Cache {
}
function WP_Object_Cache() {
global $blog_id;
global $blog_id, $wpdb;
if (defined('DISABLE_CACHE'))
return;
@@ -426,6 +423,11 @@ class WP_Object_Cache {
if (defined('CACHE_EXPIRATION_TIME'))
$this->expiration_time = CACHE_EXPIRATION_TIME;
if ( defined('WP_SECRET') )
$this->secret = WP_SECRET;
else
$this->secret = DB_PASSWORD . DB_USER . DB_NAME . DB_HOST . ABSPATH;
$this->blog_id = $this->hash($blog_id);
}
}