diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-03-28 22:30:55 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-03-28 23:47:44 +0200 |
commit | d8e9db207f94d8a46cd8a81caa1b49cd64843259 (patch) | |
tree | b12c15e87c5a97ce58eb2323de2fbbe48b7ac5a9 /lib | |
parent | f42897344fd938edcdc955c0dd0094391f5df18a (diff) | |
download | nextcloud-server-d8e9db207f94d8a46cd8a81caa1b49cd64843259.tar.gz nextcloud-server-d8e9db207f94d8a46cd8a81caa1b49cd64843259.zip |
add tempory folder utility to OC_Helper
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/helper.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/helper.php b/lib/helper.php index 66f31d929be..efff00c2fe6 100755 --- a/lib/helper.php +++ b/lib/helper.php @@ -432,6 +432,19 @@ class OC_Helper { self::$tmpFiles[]=$file; return $file; } + + /** + * create a temporary folder with an unique filename + * @return string + * + * temporary files are automatically cleaned up after the script is finished + */ + public static function tmpFolder(){ + $path=get_temp_dir().'/'.md5(time().rand()); + mkdir($path); + self::$tmpFiles[]=$path; + return $path.'/'; + } /** * remove all files created by self::tmpFile @@ -439,7 +452,7 @@ class OC_Helper { public static function cleanTmp(){ foreach(self::$tmpFiles as $file){ if(file_exists($file)){ - unlink($file); + self::rmdirr($file); } } } |