From 9dc1455158e86f162444394dd0e0092d474ae4cc Mon Sep 17 00:00:00 2001 From: icewing Date: Wed, 19 Mar 2008 16:49:31 +0000 Subject: Marcus Povey * 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 --- engine/lib/cache.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'engine/lib') 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); } -- cgit v1.2.3