aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-03-19 10:54:39 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-03-19 10:54:39 +0100
commit1088068c60d4d085b5751485cf233459d5b0fe3f (patch)
tree9e03b90f294248155cd6249df8cf39f1f91e7aba
parent47a300814186061991821f8a707c63a3de636b6d (diff)
downloadnextcloud-server-1088068c60d4d085b5751485cf233459d5b0fe3f.tar.gz
nextcloud-server-1088068c60d4d085b5751485cf233459d5b0fe3f.zip
Remove \OCP\Files::tmpFolder
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r--lib/private/Archive/TAR.php6
-rw-r--r--lib/public/Files.php12
-rw-r--r--tests/lib/Archive/TestBase.php2
-rw-r--r--tests/lib/UtilTest.php4
4 files changed, 6 insertions, 18 deletions
diff --git a/lib/private/Archive/TAR.php b/lib/private/Archive/TAR.php
index c9396673399..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;
diff --git a/lib/public/Files.php b/lib/public/Files.php
index e596997a47e..7b1b1921ed9 100644
--- a/lib/public/Files.php
+++ b/lib/public/Files.php
@@ -89,18 +89,6 @@ class Files {
}
/**
- * 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/TestBase.php b/tests/lib/Archive/TestBase.php
index 80750a1694c..bdfe65d4304 100644
--- a/tests/lib/Archive/TestBase.php
+++ b/tests/lib/Archive/TestBase.php
@@ -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/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);