summaryrefslogtreecommitdiffstats
path: root/system/helpers/file_helper.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-04-03 15:21:48 +0200
committerAndrey Andreev <narf@bofh.bg>2012-04-03 15:21:48 +0200
commitfd6c2bc7ed0ce474ac08fefb3efe88288368da98 (patch)
treea9f79a0ebda991c138cbe2cc2f4e2b52c35b46e2 /system/helpers/file_helper.php
parent1b815532378bd444347d1bc741771e13108147b6 (diff)
Fix issue #1238
Diffstat (limited to 'system/helpers/file_helper.php')
-rw-r--r--system/helpers/file_helper.php8
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);
}