Skip to content
Snippets Groups Projects
Commit a76ff563 authored by Robin Appelman's avatar Robin Appelman
Browse files

fix temporary file creation

parent 7ec1c070
Branches
No related tags found
No related merge requests found
...@@ -425,8 +425,11 @@ class OC_Helper { ...@@ -425,8 +425,11 @@ class OC_Helper {
* temporary files are automatically cleaned up after the script is finished * temporary files are automatically cleaned up after the script is finished
*/ */
public static function tmpFile($postfix=''){ public static function tmpFile($postfix=''){
$file=tempnam(get_temp_dir(),'OC_TMP_').$postfix; $file=get_temp_dir().'/'.md5(time().rand()).$postfix;
$fh=fopen($file,'w');
fclose($fh);
self::$tmpFiles[]=$file; self::$tmpFiles[]=$file;
error_log($file);
return $file; return $file;
} }
...@@ -436,6 +439,7 @@ class OC_Helper { ...@@ -436,6 +439,7 @@ class OC_Helper {
public static function cleanTmp(){ public static function cleanTmp(){
foreach(self::$tmpFiles as $file){ foreach(self::$tmpFiles as $file){
if(file_exists($file)){ if(file_exists($file)){
error_log("clean $file");
unlink($file); unlink($file);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment