aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Upload/UploadFolder.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/Upload/UploadFolder.php')
-rw-r--r--apps/dav/lib/Upload/UploadFolder.php48
1 files changed, 14 insertions, 34 deletions
diff --git a/apps/dav/lib/Upload/UploadFolder.php b/apps/dav/lib/Upload/UploadFolder.php
index a1dade0e865..8890d472f87 100644
--- a/apps/dav/lib/Upload/UploadFolder.php
+++ b/apps/dav/lib/Upload/UploadFolder.php
@@ -1,26 +1,9 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Lukas Reschke <lukas@statuscode.ch>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCA\DAV\Upload;
@@ -28,21 +11,18 @@ use OC\Files\ObjectStore\ObjectStoreStorage;
use OCA\DAV\Connector\Sabre\Directory;
use OCP\Files\ObjectStore\IObjectStoreMultiPartUpload;
use OCP\Files\Storage\IStorage;
+use OCP\ICacheFactory;
+use OCP\Server;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\ICollection;
class UploadFolder implements ICollection {
- /** @var Directory */
- private $node;
- /** @var CleanupService */
- private $cleanupService;
- /** @var IStorage */
- private $storage;
-
- public function __construct(Directory $node, CleanupService $cleanupService, IStorage $storage) {
- $this->node = $node;
- $this->cleanupService = $cleanupService;
- $this->storage = $storage;
+ public function __construct(
+ private Directory $node,
+ private CleanupService $cleanupService,
+ private IStorage $storage,
+ private string $uid,
+ ) {
}
public function createFile($name, $data = null) {
@@ -83,7 +63,7 @@ class UploadFolder implements ICollection {
/** @var ObjectStoreStorage $storage */
$objectStore = $this->storage->getObjectStore();
if ($objectStore instanceof IObjectStoreMultiPartUpload) {
- $cache = \OC::$server->getMemCacheFactory()->createDistributed(ChunkingV2Plugin::CACHE_KEY);
+ $cache = Server::get(ICacheFactory::class)->createDistributed(ChunkingV2Plugin::CACHE_KEY);
$uploadSession = $cache->get($this->getName());
if ($uploadSession) {
$uploadId = $uploadSession[ChunkingV2Plugin::UPLOAD_ID];
@@ -110,7 +90,7 @@ class UploadFolder implements ICollection {
$this->node->delete();
// Background cleanup job is not needed anymore
- $this->cleanupService->removeJob($this->getName());
+ $this->cleanupService->removeJob($this->uid, $this->getName());
}
public function getName() {