Make WordPress Core


Ignore:
Timestamp:
11/08/2005 10:15:06 PM (21 years ago)
Author:
ryan
Message:

Obfuscate keys with some salt. Add empty index.php files to the cache dirs to prevent directory listings. Props to ringmaster. fixes #1851

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/cache.php

    r3014 r3017  
    106106                }
    107107
    108                 $cache_file = $this->cache_dir . $this->get_group_dir($group) . "/" . md5($id);
     108                $cache_file = $this->cache_dir . $this->get_group_dir($group) . "/" . md5($id . DB_PASSWORD);
    109109                if (!file_exists($cache_file)) {
    110110                        $this->cache_misses += 1;
     
    167167                                        @ chmod($this->cache_dir . $make_dir, $perms);
    168168                        }
     169
     170                        if (!file_exists($this->cache_dir . $make_dir . "index.php")) {
     171                                touch($this->cache_dir . $make_dir . "index.php");
     172                        }
    169173                }
    170174               
     
    192196       
    193197        function save() {
    194                 //$this->stats();
     198                $this->stats();
    195199
    196200                if (!$this->cache_enabled)
     
    209213                                return;
    210214                        @ chmod($this->cache_dir, $dir_perms);
     215                }
     216               
     217                if (!file_exists($this->cache_dir . "index.php")) {
     218                        touch($this->cache_dir . "index.php");
    211219                }
    212220
     
    230238                                // TODO:  If the id is no longer in the cache, it was deleted and
    231239                                // the file should be removed.
    232                                 $cache_file = $group_dir . md5($id);
     240                                $cache_file = $group_dir . md5($id . DB_PASSWORD);
    233241                                $temp_file = tempnam($group_dir, 'tmp');
    234242                                $serial = serialize($this->cache[$group][$id]);
Note: See TracChangeset for help on using the changeset viewer.