From 9fcc28a29299fbbc242f87bf1b1e61fda6543886 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 21 Oct 2006 17:49:47 +0000 Subject: --- system/database/DB_cache.php | 2 +- system/database/DB_driver.php | 1 + system/helpers/file_helper.php | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php index 86493e77c..aee5ce6fa 100644 --- a/system/database/DB_cache.php +++ b/system/database/DB_cache.php @@ -171,7 +171,7 @@ class CI_DB_Cache { $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); } - $dir_path = $this->CI->db->cachedir.md5($segment_one.'+'.$segment_two).'/'; + $dir_path = $this->CI->db->cachedir.$segment_one.'+'.$segment_two.'/'; delete_files($dir_path, TRUE); } diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index 848d4f1c6..a24bd20d8 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -236,6 +236,7 @@ class CI_DB_driver { { if (FALSE !== ($cache = $this->CACHE->read($sql))) { + $this->load_rdriver(); return $cache; } } diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index c0f525688..635ef1ba0 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -110,7 +110,7 @@ function write_file($path, $data, $mode = 'wb') * @param bool whether to delete any directories found in the path * @return bool */ -function delete_files($path, $del_dir = FALSE) +function delete_files($path, $del_dir = FALSE, $level = 0) { // Trim the trailing slash $path = preg_replace("|^(.+?)/*$|", "\\1", $path); @@ -124,7 +124,8 @@ function delete_files($path, $del_dir = FALSE) { if (is_dir($path.'/'.$filename)) { - delete_files($path.'/'.$filename, $del_dir); + $level++; + delete_files($path.'/'.$filename, $del_dir, $level); } else { @@ -134,7 +135,7 @@ function delete_files($path, $del_dir = FALSE) } @closedir($current_dir); - if ($del_dir == TRUE) + if ($del_dir == TRUE AND $level > 0) { @rmdir($path); } -- cgit v1.2.3-24-g4f1b