WordPress.org

Plugin Directory

Changeset 645436


Ignore:
Timestamp:
12/28/12 17:26:47 (16 months ago)
Author:
fredericktownes
Message:

Hotfix for servers with directory listings / web accessible w3tc database cache directories

Location:
w3-total-cache
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • w3-total-cache/tags/0.9.2.4/lib/W3/Cache/File.php

    r428862 r645436  
    4545    var $_locking = false; 
    4646 
     47  var $use_wp_hash = false; 
    4748    /** 
    4849     * PHP5-style constructor 
     
    5556        $this->_flush_timelimit = isset($config['flush_timelimit']) ? (int) $config['flush_timelimit'] : 180; 
    5657        $this->_locking = isset($config['locking']) ? (boolean) $config['locking'] : false; 
     58        if (isset($config['module']) && $config['module'] == 'dbcache') 
     59            $this->use_wp_hash = true; 
    5760    } 
    5861 
     
    104107                    @flock($fp, LOCK_EX); 
    105108                } 
    106  
     109                @fputs($fp, '<?php /* '); 
    107110                @fputs($fp, pack('L', $expire)); 
    108111                @fputs($fp, @serialize($var)); 
     
    153156                                $data .= @fread($fp, 4096); 
    154157                            } 
    155  
     158                             
     159                            $var = substr($data, 9); 
    156160                            $var = @unserialize($data); 
    157161                        } 
     
    235239     */ 
    236240    function _get_path($key) { 
    237         $hash = md5($key); 
    238         $path = sprintf('%s/%s/%s/%s', substr($hash, 0, 1), substr($hash, 1, 1), substr($hash, 2, 1), $hash); 
     241        if (function_exists('wp_hash') && $this->use_wp_hash) 
     242            $hash = wp_hash($key); 
     243        else 
     244            $hash = md5($key); 
     245        $path = sprintf('%s/%s/%s/%s.php', substr($hash, 0, 3), substr($hash, 3, 3), substr($hash, 6, 3), $hash); 
    239246 
    240247        return $path; 
  • w3-total-cache/tags/0.9.2.4/lib/W3/Db.php

    r428862 r645436  
    308308                    $engineConfig = array(); 
    309309            } 
    310  
     310        $engineConfig['module'] = 'dbcache'; 
    311311            require_once W3TC_LIB_W3_DIR . '/Cache.php'; 
    312312            @$cache[0] = & W3_Cache::instance($engine, $engineConfig); 
  • w3-total-cache/tags/0.9.2.4/readme.txt

    r428882 r645436  
    33Tags: user experience, cache, caching, page cache, css cache, js cache, db cache, disk cache, disk caching, database cache, http compression, gzip, deflate, minify, cdn, content delivery network, media library, performance, speed, multiple hosts, css, merge, combine, unobtrusive javascript, compress, optimize, optimizer, javascript, js, cascading style sheet, plugin, yslow, yui, google, google rank, google page speed, mod_pagespeed, s3, cloudfront, aws, amazon web services, cloud files, rackspace, cotendo, max cdn, limelight, cloudflare, microsoft, microsoft azure, iis, nginx, litespeed, apache, varnish, xcache, apc, eacclerator, wincache, mysql, w3 total cache, batcache, wp cache, wp super cache, buddypress 
    44Requires at least: 2.8 
    5 Tested up to: 3.2.1 
     5Tested up to: 3.5 
    66Stable tag: 0.9.2.4 
    77 
  • w3-total-cache/trunk/lib/W3/Cache/File.php

    r410604 r645436  
    4545    var $_locking = false; 
    4646 
     47  var $use_wp_hash = false; 
    4748    /** 
    4849     * PHP5-style constructor 
     
    5556        $this->_flush_timelimit = isset($config['flush_timelimit']) ? (int) $config['flush_timelimit'] : 180; 
    5657        $this->_locking = isset($config['locking']) ? (boolean) $config['locking'] : false; 
     58        if (isset($config['module']) && $config['module'] == 'dbcache') 
     59            $this->use_wp_hash = true; 
    5760    } 
    5861 
     
    104107                    @flock($fp, LOCK_EX); 
    105108                } 
    106  
     109                @fputs($fp, '<?php /* '); 
    107110                @fputs($fp, pack('L', $expire)); 
    108111                @fputs($fp, @serialize($var)); 
     
    153156                                $data .= @fread($fp, 4096); 
    154157                            } 
    155  
     158                            $data = substr($data, 9); 
    156159                            $var = @unserialize($data); 
    157160                        } 
     
    235238     */ 
    236239    function _get_path($key) { 
    237         $hash = md5($key); 
    238         $path = sprintf('%s/%s/%s/%s', substr($hash, 0, 1), substr($hash, 1, 1), substr($hash, 2, 1), $hash); 
     240        if (function_exists('wp_hash') && $this->use_wp_hash) 
     241            $hash = wp_hash($key); 
     242        else 
     243            $hash = md5($key); 
     244        $path = sprintf('%s/%s/%s/%s.php', substr($hash, 0, 3), substr($hash, 3, 3), substr($hash, 6, 3), $hash); 
    239245 
    240246        return $path; 
  • w3-total-cache/trunk/lib/W3/Db.php

    r430980 r645436  
    322322                    $engineConfig = array(); 
    323323            } 
    324  
     324        $engineConfig['module'] = 'dbcache'; 
    325325            require_once W3TC_LIB_W3_DIR . '/Cache.php'; 
    326326            @$cache[0] = & W3_Cache::instance($engine, $engineConfig); 
  • w3-total-cache/trunk/readme.txt

    r430980 r645436  
    33Tags: user experience, cache, caching, page cache, css cache, js cache, db cache, disk cache, disk caching, database cache, http compression, gzip, deflate, minify, cdn, content delivery network, media library, performance, speed, multiple hosts, css, merge, combine, unobtrusive javascript, compress, optimize, optimizer, javascript, js, cascading style sheet, plugin, yslow, yui, google, google rank, google page speed, mod_pagespeed, s3, cloudfront, aws, amazon web services, cloud files, rackspace, cotendo, max cdn, limelight, cloudflare, microsoft, microsoft azure, iis, nginx, litespeed, apache, varnish, xcache, apc, eacclerator, wincache, mysql, w3 total cache, batcache, wp cache, wp super cache, buddypress 
    44Requires at least: 2.8 
    5 Tested up to: 3.2.1 
     5Tested up to: 3.5 
    66Stable tag: 0.9.2.4 
    77 
Note: See TracChangeset for help on using the changeset viewer.