diff options
author | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-19 16:49:31 +0000 |
---|---|---|
committer | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-19 16:49:31 +0000 |
commit | 9dc1455158e86f162444394dd0e0092d474ae4cc (patch) | |
tree | 16a5c05f4e221cd20af2368cf86362a5829b4796 /engine/lib | |
parent | ee39a5fe1da54d5c5b99c47ea701229b41b0b0a7 (diff) | |
download | elgg-9dc1455158e86f162444394dd0e0092d474ae4cc.tar.gz elgg-9dc1455158e86f162444394dd0e0092d474ae4cc.tar.bz2 |
Marcus Povey <marcus@dushka.co.uk>
* Cache no longer using matrix directory due to issues with mkdir.
git-svn-id: https://code.elgg.org/elgg/trunk@252 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/cache.php | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/engine/lib/cache.php b/engine/lib/cache.php index 66e467c86..94637142e 100644 --- a/engine/lib/cache.php +++ b/engine/lib/cache.php @@ -88,9 +88,9 @@ */ function __construct($cache_path, $max_age = 0, $max_size = 0) { - set_variable("cache_path", $cache_path); - set_variable("max_age", $max_age); - set_variable("max_size", $max_size); + $this->set_variable("cache_path", $cache_path); + $this->set_variable("max_age", $max_age); + $this->set_variable("max_size", $max_size); if ($cache_path=="") throw new ConfigurationException("Cache path set to nothing!"); } @@ -105,14 +105,20 @@ { // Create a filename matrix $matrix = ""; - for ($n = 0; $n < strlen($filename); $n++) - $matrix .= $filename[$n] . "/"; - + $depth = strlen($filename); + if ($depth > 5) $depth = 5; + + // for ($n = 0; $n < $depth; $n++) + // $matrix .= $filename[$n] . "/"; + // Create full path - $path = $this->set_variable("cache_path") . $matrix; - if (!mkdir($path, 0700, true)) throw new IOException("Could not make $path"); + $path = $this->get_variable("cache_path") . $matrix; + + // if (!mkdir($path, 0700, true)) throw new IOException("Could not make $path"); // Open the file + if (!file_exists($path . $filename)) return false; + return fopen($path . $filename, $rw); } |