aboutsummaryrefslogtreecommitdiffstats
path: root/lib/helper.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-11-18 14:07:52 +0100
committerRobin Appelman <icewind@owncloud.com>2012-11-18 14:07:52 +0100
commita922eb756eeb5a301772361c22b0d7f40b1f1cb0 (patch)
treeae27f291902989b5fe5c044499a9fb8c16a1cb4d /lib/helper.php
parent3358bface5c20aeb4ad41dc1edffb895bc24af71 (diff)
parentea80a8b9e3adb4fb091d0d5c80280de683b7b1a3 (diff)
downloadnextcloud-server-a922eb756eeb5a301772361c22b0d7f40b1f1cb0.tar.gz
nextcloud-server-a922eb756eeb5a301772361c22b0d7f40b1f1cb0.zip
merge master into filesystem
Diffstat (limited to 'lib/helper.php')
-rw-r--r--lib/helper.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/helper.php b/lib/helper.php
index a7fa7be8738..2b63778024d 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -525,6 +525,27 @@ class OC_Helper {
}
/**
+ * create a temporary file with an unique filename. It will not be deleted
+ * automatically
+ * @param string $postfix
+ * @return string
+ *
+ */
+ public static function tmpFileNoClean($postfix='') {
+ $tmpDirNoClean=get_temp_dir().'/oc-noclean/';
+ if (!file_exists($tmpDirNoClean) || !is_dir($tmpDirNoClean)) {
+ if (file_exists($tmpDirNoClean)) {
+ unlink($tmpDirNoClean);
+ }
+ mkdir($tmpDirNoClean);
+ }
+ $file=$tmpDirNoClean.md5(time().rand()).$postfix;
+ $fh=fopen($file,'w');
+ fclose($fh);
+ return $file;
+ }
+
+ /**
* create a temporary folder with an unique filename
* @return string
*
@@ -560,6 +581,16 @@ class OC_Helper {
}
/**
+ * remove all files created by self::tmpFileNoClean
+ */
+ public static function cleanTmpNoClean() {
+ $tmpDirNoCleanFile=get_temp_dir().'/oc-noclean/';
+ if(file_exists($tmpDirNoCleanFile)) {
+ self::rmdirr($tmpDirNoCleanFile);
+ }
+ }
+
+ /**
* Adds a suffix to the name in case the file exists
*
* @param $path