summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php4
-rw-r--r--apps/files_external/lib/Lib/Storage/FTP.php2
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php2
-rw-r--r--apps/files_external/lib/Lib/Storage/Swift.php2
-rw-r--r--lib/private/Archive/TAR.php8
-rw-r--r--lib/private/Archive/ZIP.php2
-rw-r--r--lib/private/Files/Storage/Flysystem.php2
-rw-r--r--lib/public/Files.php25
-rw-r--r--tests/lib/Archive/TARTest.php2
-rw-r--r--tests/lib/Archive/TestBase.php4
-rw-r--r--tests/lib/Archive/ZIPTest.php2
-rw-r--r--tests/lib/UtilTest.php4
12 files changed, 17 insertions, 42 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php
index 553e5316333..483f1610bcb 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -410,7 +410,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
}
case 'w':
case 'wb':
- $tmpFile = \OCP\Files::tmpFile();
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
$handle = fopen($tmpFile, 'w');
return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
@@ -431,7 +431,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
} else {
$ext = '';
}
- $tmpFile = \OCP\Files::tmpFile($ext);
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
if ($this->file_exists($path)) {
$source = $this->readObject($path);
file_put_contents($tmpFile, $source);
diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php
index 17afb1fcf95..dc4ab9cb0e1 100644
--- a/apps/files_external/lib/Lib/Storage/FTP.php
+++ b/apps/files_external/lib/Lib/Storage/FTP.php
@@ -128,7 +128,7 @@ class FTP extends StreamWrapper{
} else {
$ext='';
}
- $tmpFile=\OCP\Files::tmpFile($ext);
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
if ($this->file_exists($path)) {
$this->getFile($path, $tmpFile);
}
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php
index f8fd37a4d48..12ab6b0fed8 100644
--- a/apps/files_external/lib/Lib/Storage/SMB.php
+++ b/apps/files_external/lib/Lib/Storage/SMB.php
@@ -353,7 +353,7 @@ class SMB extends Common implements INotifyStorage {
if (!$this->isCreatable(dirname($path))) {
return false;
}
- $tmpFile = \OCP\Files::tmpFile($ext);
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
}
$source = fopen($tmpFile, $mode);
$share = $this->share;
diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php
index f72aa076d27..4fcd60a797d 100644
--- a/apps/files_external/lib/Lib/Storage/Swift.php
+++ b/apps/files_external/lib/Lib/Storage/Swift.php
@@ -428,7 +428,7 @@ class Swift extends \OC\Files\Storage\Common {
} else {
$ext = '';
}
- $tmpFile = \OCP\Files::tmpFile($ext);
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
// Fetch existing file if required
if ($mode[0] !== 'w' && $this->file_exists($path)) {
if ($mode[0] === 'x') {
diff --git a/lib/private/Archive/TAR.php b/lib/private/Archive/TAR.php
index f37da6fc52d..ef2ea83c3c6 100644
--- a/lib/private/Archive/TAR.php
+++ b/lib/private/Archive/TAR.php
@@ -139,7 +139,7 @@ class TAR extends Archive {
*/
public function rename($source, $dest) {
//no proper way to delete, rename entire archive, rename file and remake archive
- $tmp = \OCP\Files::tmpFolder();
+ $tmp = \OC::$server->getTempManager()->getTemporaryFolder();
$this->tar->extract($tmp);
rename($tmp . $source, $tmp . $dest);
$this->tar = null;
@@ -258,7 +258,7 @@ class TAR extends Archive {
* @return bool
*/
public function extractFile($path, $dest) {
- $tmp = \OCP\Files::tmpFolder();
+ $tmp = \OC::$server->getTempManager()->getTemporaryFolder();
if (!$this->fileExists($path)) {
return false;
}
@@ -323,7 +323,7 @@ class TAR extends Archive {
$this->fileList = false;
$this->cachedHeaders = false;
//no proper way to delete, extract entire archive, delete file and remake archive
- $tmp = \OCP\Files::tmpFolder();
+ $tmp = \OC::$server->getTempManager()->getTemporaryFolder();
$this->tar->extract($tmp);
\OCP\Files::rmdirr($tmp . $path);
$this->tar = null;
@@ -346,7 +346,7 @@ class TAR extends Archive {
} else {
$ext = '';
}
- $tmpFile = \OCP\Files::tmpFile($ext);
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
if ($this->fileExists($path)) {
$this->extractFile($path, $tmpFile);
} elseif ($mode == 'r' or $mode == 'rb') {
diff --git a/lib/private/Archive/ZIP.php b/lib/private/Archive/ZIP.php
index fb3e2fdde97..fb727aba224 100644
--- a/lib/private/Archive/ZIP.php
+++ b/lib/private/Archive/ZIP.php
@@ -198,7 +198,7 @@ class ZIP extends Archive{
}else{
$ext='';
}
- $tmpFile=\OCP\Files::tmpFile($ext);
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
if($this->fileExists($path)) {
$this->extractFile($path, $tmpFile);
}
diff --git a/lib/private/Files/Storage/Flysystem.php b/lib/private/Files/Storage/Flysystem.php
index 423a6f0d83e..232222db358 100644
--- a/lib/private/Files/Storage/Flysystem.php
+++ b/lib/private/Files/Storage/Flysystem.php
@@ -206,7 +206,7 @@ abstract class Flysystem extends Common {
if (!$this->isCreatable(dirname($path))) {
return false;
}
- $tmpFile = \OCP\Files::tmpFile();
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
}
$source = fopen($tmpFile, $mode);
return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath) {
diff --git a/lib/public/Files.php b/lib/public/Files.php
index d66e0f1b645..7b1b1921ed9 100644
--- a/lib/public/Files.php
+++ b/lib/public/Files.php
@@ -89,31 +89,6 @@ class Files {
}
/**
- * Create a temporary file with an unique filename
- * @param string $postfix
- * @return string
- *
- * temporary files are automatically cleaned up after the script is finished
- * @deprecated 8.1.0 use getTemporaryFile() of \OCP\ITempManager - \OC::$server->getTempManager()
- * @since 5.0.0
- */
- public static function tmpFile( $postfix='' ) {
- return \OC::$server->getTempManager()->getTemporaryFile($postfix);
- }
-
- /**
- * Create a temporary folder with an unique filename
- * @return string
- *
- * temporary files are automatically cleaned up after the script is finished
- * @deprecated 8.1.0 use getTemporaryFolder() of \OCP\ITempManager - \OC::$server->getTempManager()
- * @since 5.0.0
- */
- public static function tmpFolder() {
- return \OC::$server->getTempManager()->getTemporaryFolder();
- }
-
- /**
* Adds a suffix to the name in case the file exists
* @param string $path
* @param string $filename
diff --git a/tests/lib/Archive/TARTest.php b/tests/lib/Archive/TARTest.php
index 7575f6c5176..77df1c32ca4 100644
--- a/tests/lib/Archive/TARTest.php
+++ b/tests/lib/Archive/TARTest.php
@@ -18,6 +18,6 @@ class TARTest extends TestBase {
}
protected function getNew() {
- return new TAR(\OCP\Files::tmpFile('.tar.gz'));
+ return new TAR(\OC::$server->getTempManager()->getTemporaryFile('.tar.gz'));
}
}
diff --git a/tests/lib/Archive/TestBase.php b/tests/lib/Archive/TestBase.php
index 5bf4d9d43ea..bdfe65d4304 100644
--- a/tests/lib/Archive/TestBase.php
+++ b/tests/lib/Archive/TestBase.php
@@ -58,7 +58,7 @@ abstract class TestBase extends \Test\TestCase {
$textFile=$dir.'/lorem.txt';
$this->assertEquals(file_get_contents($textFile), $this->instance->getFile('lorem.txt'));
- $tmpFile=\OCP\Files::tmpFile('.txt');
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile('.txt');
$this->instance->extractFile('lorem.txt', $tmpFile);
$this->assertEquals(file_get_contents($textFile), file_get_contents($tmpFile));
}
@@ -112,7 +112,7 @@ abstract class TestBase extends \Test\TestCase {
public function testExtract() {
$dir=\OC::$SERVERROOT.'/tests/data';
$this->instance=$this->getExisting();
- $tmpDir=\OCP\Files::tmpFolder();
+ $tmpDir = \OC::$server->getTempManager()->getTemporaryFolder();
$this->instance->extract($tmpDir);
$this->assertEquals(true, file_exists($tmpDir.'lorem.txt'));
$this->assertEquals(true, file_exists($tmpDir.'dir/lorem.txt'));
diff --git a/tests/lib/Archive/ZIPTest.php b/tests/lib/Archive/ZIPTest.php
index ff0155f3d01..573339e5a19 100644
--- a/tests/lib/Archive/ZIPTest.php
+++ b/tests/lib/Archive/ZIPTest.php
@@ -18,6 +18,6 @@ class ZIPTest extends TestBase {
}
protected function getNew() {
- return new ZIP(\OCP\Files::tmpFile('.zip'));
+ return new ZIP(\OC::$server->getTempManager()->getTemporaryFile('.zip'));
}
}
diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php
index 18d065c68d6..d731085af46 100644
--- a/tests/lib/UtilTest.php
+++ b/tests/lib/UtilTest.php
@@ -332,13 +332,13 @@ class UtilTest extends \Test\TestCase {
}
public function testCheckDataDirectoryValidity() {
- $dataDir = \OCP\Files::tmpFolder();
+ $dataDir = \OC::$server->getTempManager()->getTemporaryFolder();
touch($dataDir . '/.ocdata');
$errors = \OC_Util::checkDataDirectoryValidity($dataDir);
$this->assertEmpty($errors);
\OCP\Files::rmdirr($dataDir);
- $dataDir = \OCP\Files::tmpFolder();
+ $dataDir = \OC::$server->getTempManager()->getTemporaryFolder();
// no touch
$errors = \OC_Util::checkDataDirectoryValidity($dataDir);
$this->assertNotEmpty($errors);