* @return bool
*/
function addFolder($path) {
- $tmpBase = OC_Helper::tmpFolder();
+ $tmpBase = \OC::$server->getTempManager()->getTemporaryFolder();
if (substr($path, -1, 1) != '/') {
$path .= '/';
}
}
public function getLocalFolder($path) {
- $baseDir = \OC_Helper::tmpFolder();
+ $baseDir = \OC::$server->getTempManager()->getTemporaryFolder();
$this->addLocalFolder($path, $baseDir);
return $baseDir;
}
*/
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() {
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
*
}
//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)) {
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');
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();
}
$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();
* @return array
*/
private function getStorageData() {
- $dir = \OC_Helper::tmpFolder();
+ $dir = \OC::$server->getTempManager()->getTemporaryFolder();
$this->tmpDirs[] = $dir;
return array('datadir' => $dir);
}
$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);
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));
}
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));
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));
}
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));
}
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));
}
* 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);
* 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);
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);