summaryrefslogtreecommitdiffstats
path: root/system/helpers/file_helper.php
diff options
context:
space:
mode:
authorJamie Rumbelow <jamie@jamierumbelow.net>2012-04-26 14:27:35 +0200
committerJamie Rumbelow <jamie@jamierumbelow.net>2012-04-26 14:27:35 +0200
commitd6ce1e936d60487ad8ddd099a040fba7d8f88367 (patch)
tree31dcdda9a24e2ed12135659a4e38cb4f35b0af31 /system/helpers/file_helper.php
parentbcee50ff3247dee71d83bf273e52bc10096cd48c (diff)
parent9e2d5d130eff40592b49337a8ba4d8c170934de1 (diff)
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into develop
Conflicts: system/core/Loader.php system/database/DB_query_builder.php system/database/drivers/cubrid/cubrid_driver.php system/database/drivers/mssql/mssql_driver.php system/database/drivers/mysql/mysql_driver.php system/database/drivers/mysqli/mysqli_driver.php system/database/drivers/oci8/oci8_driver.php system/database/drivers/odbc/odbc_driver.php system/database/drivers/pdo/pdo_driver.php system/database/drivers/postgre/postgre_driver.php system/database/drivers/sqlite/sqlite_driver.php user_guide_src/source/changelog.rst user_guide_src/source/database/query_builder.rst
Diffstat (limited to 'system/helpers/file_helper.php')
-rw-r--r--system/helpers/file_helper.php29
1 files changed, 10 insertions, 19 deletions
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 2d4b10e37..a5aabecd6 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -25,8 +25,6 @@
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* CodeIgniter File Helpers
*
@@ -44,7 +42,6 @@
*
* Opens the file specfied in the path and returns it as a string.
*
- * @access public
* @param string path to file
* @return string
*/
@@ -90,7 +87,6 @@ if ( ! function_exists('read_file'))
* Writes data to the file specified in the path.
* Creates a new file if non-existent.
*
- * @access public
* @param string path to file
* @param string file data
* @return bool
@@ -123,14 +119,15 @@ if ( ! function_exists('write_file'))
* If the second parameter is set to TRUE, any directories contained
* within the supplied base directory will be nuked as well.
*
- * @access public
* @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);
@@ -142,21 +139,21 @@ if ( ! function_exists('delete_files'))
while (FALSE !== ($filename = @readdir($current_dir)))
{
- if ($filename !== '.' and $filename !== '..')
+ if ($filename !== '.' && $filename !== '..')
{
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)|web\.config)$/i', $filename))
{
- unlink($path.DIRECTORY_SEPARATOR.$filename);
+ @unlink($path.DIRECTORY_SEPARATOR.$filename);
}
}
}
@closedir($current_dir);
- if ($del_dir == TRUE AND $level > 0)
+ if ($del_dir == TRUE && $level > 0)
{
return @rmdir($path);
}
@@ -173,7 +170,6 @@ if ( ! function_exists('delete_files'))
* Reads the specified directory and builds an array containing the filenames.
* Any sub-folders contained within the specified path are read as well.
*
- * @access public
* @param string path to source
* @param bool whether to include the path as part of the filename
* @param bool internal variable to determine recursion status - do not use in calls
@@ -224,7 +220,6 @@ if ( ! function_exists('get_filenames'))
*
* Any sub-folders contained within the specified path are read as well.
*
- * @access public
* @param string path to source
* @param bool Look only at the top level directory specified?
* @param bool internal variable to determine recursion status - do not use in calls
@@ -278,7 +273,6 @@ if ( ! function_exists('get_dir_file_info'))
* Options are: name, server_path, size, date, readable, writable, executable, fileperms
* Returns FALSE if the file cannot be found.
*
-* @access public
* @param string path to file
* @param mixed array or comma separated string of information returned
* @return array
@@ -345,7 +339,6 @@ if ( ! function_exists('get_file_info'))
* Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience
* It should NOT be trusted, and should certainly NOT be used for security
*
- * @access public
* @param string path to file
* @return mixed
*/
@@ -399,7 +392,6 @@ if ( ! function_exists('get_mime_by_extension'))
* Takes a numeric value representing a file's permissions and returns
* standard symbolic notation representing that value
*
- * @access public
* @param int
* @return string
*/
@@ -467,7 +459,6 @@ if ( ! function_exists('symbolic_permissions'))
* Takes a numeric value representing a file's permissions and returns
* a three character string representing the file's octal permissions
*
- * @access public
* @param int
* @return string
*/
@@ -480,4 +471,4 @@ if ( ! function_exists('octal_permissions'))
}
/* End of file file_helper.php */
-/* Location: ./system/helpers/file_helper.php */
+/* Location: ./system/helpers/file_helper.php */ \ No newline at end of file