Obfuscate keys with some salt. Add empty index.php files to the cache dirs to prevent directory listings. Props to ringmaster. fixes #1851
git-svn-id: http://svn.automattic.com/wordpress/trunk@3017 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
98d7be84ca
commit
b9ee18b899
|
@ -105,7 +105,7 @@ class WP_Object_Cache {
|
|||
return false;
|
||||
}
|
||||
|
||||
$cache_file = $this->cache_dir . $this->get_group_dir($group) . "/" . md5($id);
|
||||
$cache_file = $this->cache_dir . $this->get_group_dir($group) . "/" . md5($id . DB_PASSWORD);
|
||||
if (!file_exists($cache_file)) {
|
||||
$this->cache_misses += 1;
|
||||
return false;
|
||||
|
@ -166,6 +166,10 @@ class WP_Object_Cache {
|
|||
break;
|
||||
@ chmod($this->cache_dir . $make_dir, $perms);
|
||||
}
|
||||
|
||||
if (!file_exists($this->cache_dir . $make_dir . "index.php")) {
|
||||
touch($this->cache_dir . $make_dir . "index.php");
|
||||
}
|
||||
}
|
||||
|
||||
return $this->cache_dir . "$group_dir/";
|
||||
|
@ -191,7 +195,7 @@ class WP_Object_Cache {
|
|||
}
|
||||
|
||||
function save() {
|
||||
//$this->stats();
|
||||
$this->stats();
|
||||
|
||||
if (!$this->cache_enabled)
|
||||
return;
|
||||
|
@ -209,6 +213,10 @@ class WP_Object_Cache {
|
|||
return;
|
||||
@ chmod($this->cache_dir, $dir_perms);
|
||||
}
|
||||
|
||||
if (!file_exists($this->cache_dir . "index.php")) {
|
||||
touch($this->cache_dir . "index.php");
|
||||
}
|
||||
|
||||
// Acquire a write lock. Semaphore preferred. Fallback to flock.
|
||||
if (function_exists('sem_get')) {
|
||||
|
@ -229,7 +237,7 @@ class WP_Object_Cache {
|
|||
foreach ($ids as $id) {
|
||||
// TODO: If the id is no longer in the cache, it was deleted and
|
||||
// the file should be removed.
|
||||
$cache_file = $group_dir . md5($id);
|
||||
$cache_file = $group_dir . md5($id . DB_PASSWORD);
|
||||
$temp_file = tempnam($group_dir, 'tmp');
|
||||
$serial = serialize($this->cache[$group][$id]);
|
||||
$fd = fopen($temp_file, 'w');
|
||||
|
|
Loading…
Reference in New Issue