From 702da31f14353d6cd983250c42c4eae2ef0965b3 Mon Sep 17 00:00:00 2001 From: Eike Foken Date: Fri, 19 Aug 2011 01:41:33 +0200 Subject: [PATCH] Add extension for CI's directory helper --- application/helpers/MY_directory_helper.php | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 application/helpers/MY_directory_helper.php diff --git a/application/helpers/MY_directory_helper.php b/application/helpers/MY_directory_helper.php new file mode 100644 index 0000000..a476283 --- /dev/null +++ b/application/helpers/MY_directory_helper.php @@ -0,0 +1,26 @@ + + */ + +/** + * Creates a directory if it not already exists. Works recursively. + * + * @param string $path Path to the directory to create + * @return boolean + */ +if (!function_exists('mkdirs')) { + function mkdirs($path, $mode = 0777) { + if (!is_dir($path)) { + $old_umask = umask(0); + $result = mkdir($path, $mode, true); + umask($old_umask); + } + return $result; + } +} + +/* End of file MY_file_helper.php */ +/* Location: ./application/helpers/MY_file_helper.php */