]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use TempManager instead of tmpFolder
authorMorris Jobke <hey@morrisjobke.de>
Fri, 18 Dec 2015 10:19:53 +0000 (11:19 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Fri, 18 Dec 2015 10:19:53 +0000 (11:19 +0100)
17 files changed:
lib/private/archive/tar.php
lib/private/files/storage/common.php
lib/private/files/storage/temporary.php
lib/private/helper.php
lib/private/installer.php
tests/lib/configtests.php
tests/lib/files/cache/homecache.php
tests/lib/files/etagtest.php
tests/lib/files/filesystem.php
tests/lib/files/storage/commontest.php
tests/lib/files/storage/home.php
tests/lib/files/storage/local.php
tests/lib/files/storage/wrapper/quota.php
tests/lib/files/storage/wrapper/wrapper.php
tests/lib/files/view.php
tests/lib/helper.php
tests/lib/utilcheckserver.php

index 4448e56850db16503d00bbbdaaad33b36f777b10..4066e1d86c19c766458e839484c23863447298ac 100644 (file)
@@ -86,7 +86,7 @@ class OC_Archive_TAR extends OC_Archive {
         * @return bool
         */
        function addFolder($path) {
-               $tmpBase = OC_Helper::tmpFolder();
+               $tmpBase = \OC::$server->getTempManager()->getTemporaryFolder();
                if (substr($path, -1, 1) != '/') {
                        $path .= '/';
                }
index 091f2edb6297df9d80a0f4eb1e924c6005e68598..1e30d48f613374ba1b6ec7bd6c00d33f2d9194ab 100644 (file)
@@ -248,7 +248,7 @@ abstract class Common implements Storage {
        }
 
        public function getLocalFolder($path) {
-               $baseDir = \OC_Helper::tmpFolder();
+               $baseDir = \OC::$server->getTempManager()->getTemporaryFolder();
                $this->addLocalFolder($path, $baseDir);
                return $baseDir;
        }
index c8b99a5563795c0c0f0e7d0a33613c8e19350846..8abc19929b03099a1fcd35c6a49b7c6fa1786251 100644 (file)
@@ -29,7 +29,7 @@ namespace OC\Files\Storage;
  */
 class Temporary extends Local{
        public function __construct($arguments = null) {
-               parent::__construct(array('datadir' => \OC_Helper::tmpFolder()));
+               parent::__construct(array('datadir' => \OC::$server->getTempManager()->getTemporaryFolder()));
        }
 
        public function cleanUp() {
index 72282362fe6767c0ef7add334946476a7660d8fa..556286f351949703ef28ef7eda35efc8395ecf64 100644 (file)
@@ -469,18 +469,6 @@ class OC_Helper {
                return \OC::$server->getTempManager()->getTemporaryFile($postfix);
        }
 
-       /**
-        * create a temporary folder with an unique filename
-        *
-        * @return string
-        * @deprecated Use the TempManager instead
-        *
-        * temporary files are automatically cleaned up after the script is finished
-        */
-       public static function tmpFolder() {
-               return \OC::$server->getTempManager()->getTemporaryFolder();
-       }
-
        /**
         * Adds a suffix to the name in case the file exists
         *
index fa9fc6704dff2b842748e3987e4efc443cccaa1b..c188f15718a2df7279d8afc7a3de037e988f8504 100644 (file)
@@ -284,7 +284,7 @@ class OC_Installer{
                }
 
                //extract the archive in a temporary folder
-               $extractDir=OC_Helper::tmpFolder();
+               $extractDir = \OC::$server->getTempManager()->getTemporaryFolder();
                OC_Helper::rmdirr($extractDir);
                mkdir($extractDir);
                if($archive=OC_Archive::open($path)) {
index 0269ae542f403a00934d33661e5ec53f3ce428af..c0251e693c62ecb982e4011675f2c23e308f4b05 100644 (file)
@@ -23,7 +23,7 @@ class ConfigTests extends TestCase {
        protected function setUp() {
                parent::setUp();
 
-               $this->randomTmpDir = \OC_Helper::tmpFolder();
+               $this->randomTmpDir = \OC::$server->getTempManager()->getTemporaryFolder();
                $this->configFile = $this->randomTmpDir.'testconfig.php';
                file_put_contents($this->configFile, self::TESTCONTENT);
                $this->config = new \OC\Config($this->randomTmpDir, 'testconfig.php');
index 3adb25fa9d445d437758d2ded307c8b9b1df19ba..e133d0afc55909ea2b1649dd847d2e5062f6357a 100644 (file)
@@ -69,7 +69,7 @@ class HomeCache extends \Test\TestCase {
        protected function setUp() {
                parent::setUp();
 
-               $this->user = new DummyUser('foo', \OC_Helper::tmpFolder());
+               $this->user = new DummyUser('foo', \OC::$server->getTempManager()->getTemporaryFolder());
                $this->storage = new \OC\Files\Storage\Home(array('user' => $this->user));
                $this->cache = $this->storage->getCache();
        }
index c214a3d4da6484ab6ca244efe8db55c5b0d65916..d8e44000f9caafeb21dec10cae3bc382dd2f77a0 100644 (file)
@@ -39,7 +39,7 @@ class EtagTest extends \Test\TestCase {
 
                $config = \OC::$server->getConfig();
                $this->datadir = $config->getSystemValue('datadirectory');
-               $this->tmpDir = \OC_Helper::tmpFolder();
+               $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder();
                $config->setSystemValue('datadirectory', $this->tmpDir);
 
                $this->userBackend = new \Test\Util\User\Dummy();
index de8979affd16e4be5c58afb3da5b2fdc8e45e113..328ba5f44889c21e739a9f57fbcf851f5de4e621 100644 (file)
@@ -72,7 +72,7 @@ class Filesystem extends \Test\TestCase {
         * @return array
         */
        private function getStorageData() {
-               $dir = \OC_Helper::tmpFolder();
+               $dir = \OC::$server->getTempManager()->getTemporaryFolder();
                $this->tmpDirs[] = $dir;
                return array('datadir' => $dir);
        }
@@ -416,7 +416,7 @@ class Filesystem extends \Test\TestCase {
                $config = \OC::$server->getConfig();
                $oldCachePath = $config->getSystemValue('cache_path', '');
                // set cache path to temp dir
-               $cachePath = \OC_Helper::tmpFolder() . '/extcache';
+               $cachePath = \OC::$server->getTempManager()->getTemporaryFolder() . '/extcache';
                $config->setSystemValue('cache_path', $cachePath);
 
                \OC::$server->getUserManager()->createUser($userId, $userId);
index bbe6f2a73e2ba75e6ec1556fcb653fbe739f5da2..38faa9b0b210855f84611773e1d1e6b88e64b2f7 100644 (file)
@@ -37,7 +37,7 @@ class CommonTest extends Storage {
        protected function setUp() {
                parent::setUp();
 
-               $this->tmpDir=\OC_Helper::tmpFolder();
+               $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder();
                $this->instance=new \OC\Files\Storage\CommonTest(array('datadir'=>$this->tmpDir));
        }
 
index a51912ca1b2fee8261aef5210095897ce180ca48..7e10f09d554cb470f4060d8d1ce9e5e0867e845e 100644 (file)
@@ -70,7 +70,7 @@ class Home extends Storage {
        protected function setUp() {
                parent::setUp();
 
-               $this->tmpDir = \OC_Helper::tmpFolder();
+               $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder();
                $this->userId = $this->getUniqueID('user_');
                $this->user = new DummyUser($this->userId, $this->tmpDir);
                $this->instance = new \OC\Files\Storage\Home(array('user' => $this->user));
index 36267dc66057d81aaaace09817a86076422927d6..2583863b554abf90ab01213ed92c0fd315f7c39a 100644 (file)
@@ -38,7 +38,7 @@ class Local extends Storage {
        protected function setUp() {
                parent::setUp();
 
-               $this->tmpDir = \OC_Helper::tmpFolder();
+               $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder();
                $this->instance = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir));
        }
 
index b0a06b0d898dee9f2a266cbdd099cedf76a2c8db..95bc2ff7a1a96871b2888f13e6fdef802e4f66ef 100644 (file)
@@ -27,7 +27,7 @@ class Quota extends \Test\Files\Storage\Storage {
        protected function setUp() {
                parent::setUp();
 
-               $this->tmpDir = \OC_Helper::tmpFolder();
+               $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder();
                $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir));
                $this->instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 10000000));
        }
index 486cd0495c1c0dd4dbb05db43baa17c4750bb9cd..a5a678cb9f754e30f1ffb3d0eccd6659b0b7e8ab 100644 (file)
@@ -17,7 +17,7 @@ class Wrapper extends \Test\Files\Storage\Storage {
        protected function setUp() {
                parent::setUp();
 
-               $this->tmpDir = \OC_Helper::tmpFolder();
+               $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder();
                $storage = new \OC\Files\Storage\Local(array('datadir' => $this->tmpDir));
                $this->instance = new \OC\Files\Storage\Wrapper\Wrapper(array('storage' => $storage));
        }
index 1fc4b9ab684600f1d5a01590b416eed081f09f49..3e88a5306f891d666000a68da3038c9a21a2b397 100644 (file)
@@ -757,7 +757,7 @@ class View extends \Test\TestCase {
                 * 228 is the max path length in windows
                 */
                $folderName = 'abcdefghijklmnopqrstuvwxyz012345678901234567890123456789';
-               $tmpdirLength = strlen(\OC_Helper::tmpFolder());
+               $tmpdirLength = strlen(\OC::$server->getTempManager()->getTemporaryFolder());
                if (\OC_Util::runningOnWindows()) {
                        $this->markTestSkipped('[Windows] ');
                        $depth = ((260 - $tmpdirLength) / 57);
index 51f7342f45662ac9e8b7ea97f4ba0142a4c2149e..9ad3af3d60c4baa16144fcafd890b89af6c43248 100644 (file)
@@ -403,7 +403,7 @@ class Test_Helper extends \Test\TestCase {
         * Tests recursive folder deletion with rmdirr()
         */
        public function testRecursiveFolderDeletion() {
-               $baseDir = \OC_Helper::tmpFolder() . '/';
+               $baseDir = \OC::$server->getTempManager()->getTemporaryFolder() . '/';
                mkdir($baseDir . 'a/b/c/d/e', 0777, true);
                mkdir($baseDir . 'a/b/c1/d/e', 0777, true);
                mkdir($baseDir . 'a/b/c2/d/e', 0777, true);
index a5ec529ff85acd81c74d525e02e0c0c0542c6204..64757d0acd97775afa00e10b13a0a7b276ff0460 100644 (file)
@@ -37,7 +37,7 @@ class Test_Util_CheckServer extends \Test\TestCase {
        protected function setUp() {
                parent::setUp();
 
-               $this->datadir = \OC_Helper::tmpFolder();
+               $this->datadir = \OC::$server->getTempManager()->getTemporaryFolder();
 
                file_put_contents($this->datadir . '/.ocdata', '');
                \OC::$server->getSession()->set('checkServer_succeeded', false);