summaryrefslogtreecommitdiffstats
path: root/system/helpers/file_helper.php
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-10-21 19:49:47 +0200
committeradmin <devnull@localhost>2006-10-21 19:49:47 +0200
commit9fcc28a29299fbbc242f87bf1b1e61fda6543886 (patch)
tree4256b0fb41fc86de53ab626299a85032a1f60028 /system/helpers/file_helper.php
parentae3fbabe663d4f5f853e511b2e4619553787d3ad (diff)
Diffstat (limited to 'system/helpers/file_helper.php')
-rw-r--r--system/helpers/file_helper.php7
1 files changed, 4 insertions, 3 deletions
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);
}