diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-04-06 20:41:58 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-04-06 20:41:58 +0200 |
commit | d1587defeb0304755d9a937aa688ee82098de246 (patch) | |
tree | 54904c545b9d6054d49df8f1cbb0fb8f28727495 /system/helpers | |
parent | fd9e46e852d073ae6fb8680f26e9825805104e1c (diff) | |
parent | ea09a8a5552f2aacdeab0c88a605fe44047ebd0a (diff) |
Merge upstream branch
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); } |