summaryrefslogtreecommitdiffstats
path: root/lib/helper.php
diff options
context:
space:
mode:
authorValerio Ponte <valerio.ponte@gmail.com>2012-10-19 00:11:20 +0200
committerValerio Ponte <valerio.ponte@gmail.com>2012-11-14 20:10:20 +0100
commit8e190a5a97fd2be24370aa8d3f21b7641506ae92 (patch)
treec61cc0ffb3a8537d45deb9ad1f040cc715b6b3f5 /lib/helper.php
parent8420b9bf678d04558e7e32a5d034a1da6f49cabe (diff)
downloadnextcloud-server-8e190a5a97fd2be24370aa8d3f21b7641506ae92.tar.gz
nextcloud-server-8e190a5a97fd2be24370aa8d3f21b7641506ae92.zip
Moved X-Sendfile headers into OC_Files::get
now should work with temp files too
Diffstat (limited to 'lib/helper.php')
-rw-r--r--lib/helper.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/helper.php b/lib/helper.php
index ccceb58cd4c..b5e2b8a0d4e 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -525,6 +525,26 @@ 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 +580,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