summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/archive/tar.php2
-rw-r--r--lib/private/backgroundjob/joblist.php152
-rw-r--r--lib/private/files/objectstore/objectstorestorage.php2
-rw-r--r--lib/private/files/storage/common.php2
-rw-r--r--lib/private/files/storage/localtempfiletrait.php2
-rw-r--r--lib/private/files/storage/temporary.php2
-rw-r--r--lib/private/files/type/detection.php2
-rw-r--r--lib/private/files/view.php2
-rw-r--r--lib/private/helper.php35
-rw-r--r--lib/private/installer.php4
-rw-r--r--lib/private/preview/movie.php4
-rw-r--r--lib/public/backgroundjob/ijoblist.php8
-rw-r--r--tests/lib/backgroundjob/joblist.php13
-rw-r--r--tests/lib/configtests.php2
-rw-r--r--tests/lib/files/cache/homecache.php2
-rw-r--r--tests/lib/files/etagtest.php2
-rw-r--r--tests/lib/files/filesystem.php6
-rw-r--r--tests/lib/files/storage/commontest.php2
-rw-r--r--tests/lib/files/storage/home.php2
-rw-r--r--tests/lib/files/storage/local.php2
-rw-r--r--tests/lib/files/storage/wrapper/quota.php2
-rw-r--r--tests/lib/files/storage/wrapper/wrapper.php2
-rw-r--r--tests/lib/files/view.php2
-rw-r--r--tests/lib/helper.php2
-rw-r--r--tests/lib/installer.php6
-rw-r--r--tests/lib/streamwrappers.php4
-rw-r--r--tests/lib/utilcheckserver.php2
27 files changed, 139 insertions, 129 deletions
diff --git a/lib/private/archive/tar.php b/lib/private/archive/tar.php
index 4448e56850d..4066e1d86c1 100644
--- a/lib/private/archive/tar.php
+++ b/lib/private/archive/tar.php
@@ -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 .= '/';
}
diff --git a/lib/private/backgroundjob/joblist.php b/lib/private/backgroundjob/joblist.php
index 03c9180ddb0..75c205833fe 100644
--- a/lib/private/backgroundjob/joblist.php
+++ b/lib/private/backgroundjob/joblist.php
@@ -24,134 +24,179 @@
namespace OC\BackgroundJob;
+use OCP\BackgroundJob\IJob;
use OCP\BackgroundJob\IJobList;
use OCP\AutoloadNotAllowedException;
class JobList implements IJobList {
- /**
- * @var \OCP\IDBConnection
- */
- private $conn;
+ /** @var \OCP\IDBConnection */
+ protected $connection;
/**
* @var \OCP\IConfig $config
*/
- private $config;
+ protected $config;
/**
- * @param \OCP\IDBConnection $conn
+ * @param \OCP\IDBConnection $connection
* @param \OCP\IConfig $config
*/
- public function __construct($conn, $config) {
- $this->conn = $conn;
+ public function __construct($connection, $config) {
+ $this->connection = $connection;
$this->config = $config;
}
/**
- * @param Job|string $job
+ * @param IJob|string $job
* @param mixed $argument
*/
public function add($job, $argument = null) {
if (!$this->has($job, $argument)) {
- if ($job instanceof Job) {
+ if ($job instanceof IJob) {
$class = get_class($job);
} else {
$class = $job;
}
+
$argument = json_encode($argument);
if (strlen($argument) > 4000) {
throw new \InvalidArgumentException('Background job arguments can\'t exceed 4000 characters (json encoded)');
}
- $query = $this->conn->prepare('INSERT INTO `*PREFIX*jobs`(`class`, `argument`, `last_run`) VALUES(?, ?, 0)');
- $query->execute(array($class, $argument));
+
+ $query = $this->connection->getQueryBuilder();
+ $query->insert('jobs')
+ ->values([
+ 'class' => $query->createNamedParameter($class),
+ 'argument' => $query->createNamedParameter($argument),
+ 'last_run' => $query->createNamedParameter(0, \PDO::PARAM_INT),
+ ]);
+ $query->execute();
}
}
/**
- * @param Job|string $job
+ * @param IJob|string $job
* @param mixed $argument
*/
public function remove($job, $argument = null) {
- if ($job instanceof Job) {
+ if ($job instanceof IJob) {
$class = get_class($job);
} else {
$class = $job;
}
+
+ $query = $this->connection->getQueryBuilder();
+ $query->delete('jobs')
+ ->where($query->expr()->eq('class', $query->createNamedParameter($class)));
if (!is_null($argument)) {
$argument = json_encode($argument);
- $query = $this->conn->prepare('DELETE FROM `*PREFIX*jobs` WHERE `class` = ? AND `argument` = ?');
- $query->execute(array($class, $argument));
- } else {
- $query = $this->conn->prepare('DELETE FROM `*PREFIX*jobs` WHERE `class` = ?');
- $query->execute(array($class));
+ $query->andWhere($query->expr()->eq('argument', $query->createNamedParameter($argument)));
}
+ $query->execute();
}
+ /**
+ * @param int $id
+ */
protected function removeById($id) {
- $query = $this->conn->prepare('DELETE FROM `*PREFIX*jobs` WHERE `id` = ?');
- $query->execute([$id]);
+ $query = $this->connection->getQueryBuilder();
+ $query->delete('jobs')
+ ->where($query->expr()->eq('id', $query->createNamedParameter($id, \PDO::PARAM_INT)));
+ $query->execute();
}
/**
* check if a job is in the list
*
- * @param Job|string $job
+ * @param IJob|string $job
* @param mixed $argument
* @return bool
*/
public function has($job, $argument) {
- if ($job instanceof Job) {
+ if ($job instanceof IJob) {
$class = get_class($job);
} else {
$class = $job;
}
$argument = json_encode($argument);
- $query = $this->conn->prepare('SELECT `id` FROM `*PREFIX*jobs` WHERE `class` = ? AND `argument` = ?');
- $query->execute(array($class, $argument));
- return (bool)$query->fetch();
+
+ $query = $this->connection->getQueryBuilder();
+ $query->select('id')
+ ->from('jobs')
+ ->where($query->expr()->eq('class', $query->createNamedParameter($class)))
+ ->andWhere($query->expr()->eq('argument', $query->createNamedParameter($argument)))
+ ->setMaxResults(1);
+
+ $result = $query->execute();
+ $row = $result->fetch();
+ $result->closeCursor();
+
+ return (bool) $row;
}
/**
* get all jobs in the list
*
- * @return Job[]
+ * @return IJob[]
*/
public function getAll() {
- $query = $this->conn->prepare('SELECT `id`, `class`, `last_run`, `argument` FROM `*PREFIX*jobs`');
- $query->execute();
- $jobs = array();
- while ($row = $query->fetch()) {
+ $query = $this->connection->getQueryBuilder();
+ $query->select('*')
+ ->from('jobs');
+ $result = $query->execute();
+
+ $jobs = [];
+ while ($row = $result->fetch()) {
$job = $this->buildJob($row);
if ($job) {
$jobs[] = $job;
}
}
+ $result->closeCursor();
+
return $jobs;
}
/**
* get the next job in the list
*
- * @return Job
+ * @return IJob|null
*/
public function getNext() {
$lastId = $this->getLastJob();
- $query = $this->conn->prepare('SELECT `id`, `class`, `last_run`, `argument` FROM `*PREFIX*jobs` WHERE `id` > ? ORDER BY `id` ASC', 1);
- $query->execute(array($lastId));
- if ($row = $query->fetch()) {
+
+ $query = $this->connection->getQueryBuilder();
+ $query->select('*')
+ ->from('jobs')
+ ->where($query->expr()->gt('id', $query->createNamedParameter($lastId, \PDO::PARAM_INT)))
+ ->orderBy('id', 'ASC')
+ ->setMaxResults(1);
+ $result = $query->execute();
+ $row = $result->fetch();
+ $result->closeCursor();
+
+ if ($row) {
$jobId = $row['id'];
$job = $this->buildJob($row);
} else {
//begin at the start of the queue
- $query = $this->conn->prepare('SELECT `id`, `class`, `last_run`, `argument` FROM `*PREFIX*jobs` ORDER BY `id` ASC', 1);
- $query->execute();
- if ($row = $query->fetch()) {
+ $query = $this->connection->getQueryBuilder();
+ $query->select('*')
+ ->from('jobs')
+ ->orderBy('id', 'ASC')
+ ->setMaxResults(1);
+ $result = $query->execute();
+ $row = $result->fetch();
+ $result->closeCursor();
+
+ if ($row) {
$jobId = $row['id'];
$job = $this->buildJob($row);
} else {
return null; //empty job list
}
}
+
if (is_null($job)) {
$this->removeById($jobId);
return $this->getNext();
@@ -162,12 +207,18 @@ class JobList implements IJobList {
/**
* @param int $id
- * @return Job|null
+ * @return IJob|null
*/
public function getById($id) {
- $query = $this->conn->prepare('SELECT `id`, `class`, `last_run`, `argument` FROM `*PREFIX*jobs` WHERE `id` = ?');
- $query->execute(array($id));
- if ($row = $query->fetch()) {
+ $query = $this->connection->getQueryBuilder();
+ $query->select('*')
+ ->from('jobs')
+ ->where($query->expr()->eq('id', $query->createNamedParameter($id, \PDO::PARAM_INT)));
+ $result = $query->execute();
+ $row = $result->fetch();
+ $result->closeCursor();
+
+ if ($row) {
return $this->buildJob($row);
} else {
return null;
@@ -178,7 +229,7 @@ class JobList implements IJobList {
* get the job object from a row in the db
*
* @param array $row
- * @return Job
+ * @return IJob|null
*/
private function buildJob($row) {
$class = $row['class'];
@@ -204,7 +255,7 @@ class JobList implements IJobList {
/**
* set the job that was last ran
*
- * @param Job $job
+ * @param IJob $job
*/
public function setLastJob($job) {
$this->config->setAppValue('backgroundjob', 'lastjob', $job->getId());
@@ -213,19 +264,22 @@ class JobList implements IJobList {
/**
* get the id of the last ran job
*
- * @return string
+ * @return int
*/
public function getLastJob() {
- return $this->config->getAppValue('backgroundjob', 'lastjob', 0);
+ return (int) $this->config->getAppValue('backgroundjob', 'lastjob', 0);
}
/**
* set the lastRun of $job to now
*
- * @param Job $job
+ * @param IJob $job
*/
public function setLastRun($job) {
- $query = $this->conn->prepare('UPDATE `*PREFIX*jobs` SET `last_run` = ? WHERE `id` = ?');
- $query->execute(array(time(), $job->getId()));
+ $query = $this->connection->getQueryBuilder();
+ $query->update('jobs')
+ ->set('last_run', $query->createNamedParameter(time(), \PDO::PARAM_INT))
+ ->where($query->expr()->eq('id', $query->createNamedParameter($job->getId(), \PDO::PARAM_INT)));
+ $query->execute();
}
}
diff --git a/lib/private/files/objectstore/objectstorestorage.php b/lib/private/files/objectstore/objectstorestorage.php
index a053ea6d6d2..b34a6bdfb84 100644
--- a/lib/private/files/objectstore/objectstorestorage.php
+++ b/lib/private/files/objectstore/objectstorestorage.php
@@ -274,7 +274,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
} else {
$ext = '';
}
- $tmpFile = \OC_Helper::tmpFile($ext);
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
\OC\Files\Stream\Close::registerCallback($tmpFile, array($this, 'writeBack'));
if ($this->file_exists($path)) {
$source = $this->fopen($path, 'r');
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index 091f2edb629..1e30d48f613 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -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;
}
diff --git a/lib/private/files/storage/localtempfiletrait.php b/lib/private/files/storage/localtempfiletrait.php
index 84331f49b19..8875c2c4493 100644
--- a/lib/private/files/storage/localtempfiletrait.php
+++ b/lib/private/files/storage/localtempfiletrait.php
@@ -70,7 +70,7 @@ trait LocalTempFileTrait {
} else {
$extension = '';
}
- $tmpFile = \OC_Helper::tmpFile($extension);
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($extension);
$target = fopen($tmpFile, 'w');
\OC_Helper::streamCopy($source, $target);
fclose($target);
diff --git a/lib/private/files/storage/temporary.php b/lib/private/files/storage/temporary.php
index c8b99a55637..8abc19929b0 100644
--- a/lib/private/files/storage/temporary.php
+++ b/lib/private/files/storage/temporary.php
@@ -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() {
diff --git a/lib/private/files/type/detection.php b/lib/private/files/type/detection.php
index c102e739e04..0e2bab39e5b 100644
--- a/lib/private/files/type/detection.php
+++ b/lib/private/files/type/detection.php
@@ -238,7 +238,7 @@ class Detection implements IMimeTypeDetector {
$finfo = finfo_open(FILEINFO_MIME);
return finfo_buffer($finfo, $data);
} else {
- $tmpFile = \OC_Helper::tmpFile();
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
$fh = fopen($tmpFile, 'wb');
fwrite($fh, $data, 8024);
fclose($fh);
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index b8b1b8a50d6..fcea4828c49 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -912,7 +912,7 @@ class View {
$source = $this->fopen($path, 'r');
if ($source) {
$extension = pathinfo($path, PATHINFO_EXTENSION);
- $tmpFile = \OC_Helper::tmpFile($extension);
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($extension);
file_put_contents($tmpFile, $source);
return $tmpFile;
} else {
diff --git a/lib/private/helper.php b/lib/private/helper.php
index bd69c13de50..b4a5d8cddf5 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -111,16 +111,6 @@ class OC_Helper {
}
/**
- * shows whether the user has an avatar
- * @param string $user username
- * @return bool avatar set or not
- * @deprecated 9.0.0 Use \OC::$server->getAvatarManager()->getAvatar($user)->exists();
- **/
- public static function userAvatarSet($user) {
- return \OC::$server->getAvatarManager()->getAvatar($user)->exists();
- }
-
- /**
* Make a human file size
* @param int $bytes file size in bytes
* @return string a human readable file size
@@ -403,31 +393,6 @@ class OC_Helper {
}
/**
- * create a temporary file with an unique filename
- *
- * @param string $postfix
- * @return string
- * @deprecated Use the TempManager instead
- *
- * temporary files are automatically cleaned up after the script is finished
- */
- public static function tmpFile($postfix = '') {
- 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
*
* @param string $path
diff --git a/lib/private/installer.php b/lib/private/installer.php
index fa9fc6704df..e1447db0db5 100644
--- a/lib/private/installer.php
+++ b/lib/private/installer.php
@@ -264,7 +264,7 @@ class OC_Installer{
//download the file if necessary
if($data['source']=='http') {
$pathInfo = pathinfo($data['href']);
- $path=OC_Helper::tmpFile('.' . $pathInfo['extension']);
+ $path = \OC::$server->getTempManager()->getTemporaryFile('.' . $pathInfo['extension']);
if(!isset($data['href'])) {
throw new \Exception($l->t("No href specified when installing app from http"));
}
@@ -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)) {
diff --git a/lib/private/preview/movie.php b/lib/private/preview/movie.php
index f71eaaf3eb2..2c2e6d09399 100644
--- a/lib/private/preview/movie.php
+++ b/lib/private/preview/movie.php
@@ -46,7 +46,7 @@ class Movie extends Provider {
if ($useFileDirectly) {
$absPath = $fileview->getLocalFile($path);
} else {
- $absPath = \OC_Helper::tmpFile();
+ $absPath = \OC::$server->getTempManager()->getTemporaryFile();
$handle = $fileview->fopen($path, 'rb');
@@ -79,7 +79,7 @@ class Movie extends Provider {
* @return bool|\OCP\IImage
*/
private function generateThumbNail($maxX, $maxY, $absPath, $second) {
- $tmpPath = \OC_Helper::tmpFile();
+ $tmpPath = \OC::$server->getTempManager()->getTemporaryFile();
if (self::$avconvBinary) {
$cmd = self::$avconvBinary . ' -an -y -ss ' . escapeshellarg($second) .
diff --git a/lib/public/backgroundjob/ijoblist.php b/lib/public/backgroundjob/ijoblist.php
index 384f8b3d801..51431c42a67 100644
--- a/lib/public/backgroundjob/ijoblist.php
+++ b/lib/public/backgroundjob/ijoblist.php
@@ -36,7 +36,6 @@ interface IJobList {
*
* @param \OCP\BackgroundJob\IJob|string $job
* @param mixed $argument The argument to be passed to $job->run() when the job is exectured
- * @return void
* @since 7.0.0
*/
public function add($job, $argument = null);
@@ -46,7 +45,6 @@ interface IJobList {
*
* @param \OCP\BackgroundJob\IJob|string $job
* @param mixed $argument
- * @return void
* @since 7.0.0
*/
public function remove($job, $argument = null);
@@ -72,14 +70,14 @@ interface IJobList {
/**
* get the next job in the list
*
- * @return \OCP\BackgroundJob\IJob
+ * @return \OCP\BackgroundJob\IJob|null
* @since 7.0.0
*/
public function getNext();
/**
* @param int $id
- * @return \OCP\BackgroundJob\IJob
+ * @return \OCP\BackgroundJob\IJob|null
* @since 7.0.0
*/
public function getById($id);
@@ -88,7 +86,6 @@ interface IJobList {
* set the job that was last ran to the current time
*
* @param \OCP\BackgroundJob\IJob $job
- * @return void
* @since 7.0.0
*/
public function setLastJob($job);
@@ -105,7 +102,6 @@ interface IJobList {
* set the lastRun of $job to now
*
* @param \OCP\BackgroundJob\IJob $job
- * @return void
* @since 7.0.0
*/
public function setLastRun($job);
diff --git a/tests/lib/backgroundjob/joblist.php b/tests/lib/backgroundjob/joblist.php
index 73b3255c079..c0796d8253a 100644
--- a/tests/lib/backgroundjob/joblist.php
+++ b/tests/lib/backgroundjob/joblist.php
@@ -15,26 +15,21 @@ use Test\TestCase;
* Class JobList
*
* @group DB
- *
* @package Test\BackgroundJob
*/
class JobList extends TestCase {
- /**
- * @var \OC\BackgroundJob\JobList
- */
+ /** @var \OC\BackgroundJob\JobList */
protected $instance;
- /**
- * @var \OCP\IConfig | \PHPUnit_Framework_MockObject_MockObject $config
- */
+ /** @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */
protected $config;
protected function setUp() {
parent::setUp();
- $conn = \OC::$server->getDatabaseConnection();
+ $connection = \OC::$server->getDatabaseConnection();
$this->config = $this->getMock('\OCP\IConfig');
- $this->instance = new \OC\BackgroundJob\JobList($conn, $this->config);
+ $this->instance = new \OC\BackgroundJob\JobList($connection, $this->config);
}
protected function getAllSorted() {
diff --git a/tests/lib/configtests.php b/tests/lib/configtests.php
index 0269ae542f4..c0251e693c6 100644
--- a/tests/lib/configtests.php
+++ b/tests/lib/configtests.php
@@ -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');
diff --git a/tests/lib/files/cache/homecache.php b/tests/lib/files/cache/homecache.php
index 3adb25fa9d4..e133d0afc55 100644
--- a/tests/lib/files/cache/homecache.php
+++ b/tests/lib/files/cache/homecache.php
@@ -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();
}
diff --git a/tests/lib/files/etagtest.php b/tests/lib/files/etagtest.php
index c214a3d4da6..d8e44000f9c 100644
--- a/tests/lib/files/etagtest.php
+++ b/tests/lib/files/etagtest.php
@@ -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();
diff --git a/tests/lib/files/filesystem.php b/tests/lib/files/filesystem.php
index de8979affd1..db1f22f894a 100644
--- a/tests/lib/files/filesystem.php
+++ b/tests/lib/files/filesystem.php
@@ -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);
}
@@ -302,7 +302,7 @@ class Filesystem extends \Test\TestCase {
\OC\Files\Filesystem::mkdir('/bar');
// \OC\Files\Filesystem::file_put_contents('/bar//foo', 'foo');
- $tmpFile = \OC_Helper::tmpFile();
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
file_put_contents($tmpFile, 'foo');
$fh = fopen($tmpFile, 'r');
// \OC\Files\Filesystem::file_put_contents('/bar//foo', $fh);
@@ -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);
diff --git a/tests/lib/files/storage/commontest.php b/tests/lib/files/storage/commontest.php
index bbe6f2a73e2..38faa9b0b21 100644
--- a/tests/lib/files/storage/commontest.php
+++ b/tests/lib/files/storage/commontest.php
@@ -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));
}
diff --git a/tests/lib/files/storage/home.php b/tests/lib/files/storage/home.php
index a51912ca1b2..7e10f09d554 100644
--- a/tests/lib/files/storage/home.php
+++ b/tests/lib/files/storage/home.php
@@ -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));
diff --git a/tests/lib/files/storage/local.php b/tests/lib/files/storage/local.php
index 36267dc6605..2583863b554 100644
--- a/tests/lib/files/storage/local.php
+++ b/tests/lib/files/storage/local.php
@@ -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));
}
diff --git a/tests/lib/files/storage/wrapper/quota.php b/tests/lib/files/storage/wrapper/quota.php
index b0a06b0d898..95bc2ff7a1a 100644
--- a/tests/lib/files/storage/wrapper/quota.php
+++ b/tests/lib/files/storage/wrapper/quota.php
@@ -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));
}
diff --git a/tests/lib/files/storage/wrapper/wrapper.php b/tests/lib/files/storage/wrapper/wrapper.php
index 486cd0495c1..a5a678cb9f7 100644
--- a/tests/lib/files/storage/wrapper/wrapper.php
+++ b/tests/lib/files/storage/wrapper/wrapper.php
@@ -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));
}
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 1fc4b9ab684..3e88a5306f8 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -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);
diff --git a/tests/lib/helper.php b/tests/lib/helper.php
index 468d32bc37a..dbc89b716d0 100644
--- a/tests/lib/helper.php
+++ b/tests/lib/helper.php
@@ -283,7 +283,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);
diff --git a/tests/lib/installer.php b/tests/lib/installer.php
index c3c2f8a275e..cfad4d7f0de 100644
--- a/tests/lib/installer.php
+++ b/tests/lib/installer.php
@@ -32,7 +32,7 @@ class Test_Installer extends \Test\TestCase {
$pathOfTestApp .= '/../data/';
$pathOfTestApp .= 'testapp.zip';
- $tmp = OC_Helper::tmpFile('.zip');
+ $tmp = \OC::$server->getTempManager()->getTemporaryFile('.zip');
OC_Helper::copyr($pathOfTestApp, $tmp);
$data = array(
@@ -51,7 +51,7 @@ class Test_Installer extends \Test\TestCase {
$pathOfOldTestApp .= '/../data/';
$pathOfOldTestApp .= 'testapp.zip';
- $oldTmp = OC_Helper::tmpFile('.zip');
+ $oldTmp = \OC::$server->getTempManager()->getTemporaryFile('.zip');
OC_Helper::copyr($pathOfOldTestApp, $oldTmp);
$oldData = array(
@@ -63,7 +63,7 @@ class Test_Installer extends \Test\TestCase {
$pathOfNewTestApp .= '/../data/';
$pathOfNewTestApp .= 'testapp2.zip';
- $newTmp = OC_Helper::tmpFile('.zip');
+ $newTmp = \OC::$server->getTempManager()->getTemporaryFile('.zip');
OC_Helper::copyr($pathOfNewTestApp, $newTmp);
$newData = array(
diff --git a/tests/lib/streamwrappers.php b/tests/lib/streamwrappers.php
index 9b097535280..7175683a60b 100644
--- a/tests/lib/streamwrappers.php
+++ b/tests/lib/streamwrappers.php
@@ -55,7 +55,7 @@ class Test_StreamWrappers extends \Test\TestCase {
public function testCloseStream() {
//ensure all basic stream stuff works
$sourceFile = OC::$SERVERROOT . '/tests/data/lorem.txt';
- $tmpFile = OC_Helper::TmpFile('.txt');
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile('.txt');
$file = 'close://' . $tmpFile;
$this->assertTrue(file_exists($file));
file_put_contents($file, file_get_contents($sourceFile));
@@ -65,7 +65,7 @@ class Test_StreamWrappers extends \Test\TestCase {
$this->assertFalse(file_exists($file));
//test callback
- $tmpFile = OC_Helper::TmpFile('.txt');
+ $tmpFile = \OC::$server->getTempManager()->getTemporaryFile('.txt');
$file = 'close://' . $tmpFile;
$actual = false;
$callback = function($path) use (&$actual) { $actual = $path; };
diff --git a/tests/lib/utilcheckserver.php b/tests/lib/utilcheckserver.php
index a5ec529ff85..64757d0acd9 100644
--- a/tests/lib/utilcheckserver.php
+++ b/tests/lib/utilcheckserver.php
@@ -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);