Remove \OCP\Files::tmpFolder
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
47a3008141
commit
1088068c60
|
@ -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;
|
||||
|
|
|
@ -88,18 +88,6 @@ class Files {
|
|||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue