diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-04-03 15:21:48 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-04-03 15:21:48 +0200 |
commit | fd6c2bc7ed0ce474ac08fefb3efe88288368da98 (patch) | |
tree | a9f79a0ebda991c138cbe2cc2f4e2b52c35b46e2 /system/helpers | |
parent | 1b815532378bd444347d1bc741771e13108147b6 (diff) |
Fix issue #1238
Diffstat (limited to 'system/helpers')
-rw-r--r-- | system/helpers/file_helper.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 6e8a4ded1..3a373efd3 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -121,11 +121,13 @@ if ( ! function_exists('write_file')) * * @param string path to file * @param bool whether to delete any directories found in the path + * @param int + * @param bool whether to skip deleting .htaccess and index page files * @return bool */ if ( ! function_exists('delete_files')) { - function delete_files($path, $del_dir = FALSE, $level = 0) + function delete_files($path, $del_dir = FALSE, $level = 0, $htdocs = FALSE) { // Trim the trailing slash $path = rtrim($path, DIRECTORY_SEPARATOR); @@ -141,9 +143,9 @@ if ( ! function_exists('delete_files')) { if (is_dir($path.DIRECTORY_SEPARATOR.$filename) && $filename[0] !== '.') { - delete_files($path.DIRECTORY_SEPARATOR.$filename, $del_dir, $level + 1); + delete_files($path.DIRECTORY_SEPARATOR.$filename, $del_dir, $level + 1, $htdocs); } - else + elseif ($htdocs === TRUE && ! preg_match('/^(\.htaccess|index\.(html|htm|php))$/', $filename)) { @unlink($path.DIRECTORY_SEPARATOR.$filename); } |