diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-11-02 21:19:27 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-01-04 09:21:21 +0100 |
commit | cb742e7045d1f5af7994ad1e918b0ddc9ba01914 (patch) | |
tree | 7d1681c35780cc4b4ca4283d16845ea74ad61dac /apps/dav/lib/Upload/UploadFolder.php | |
parent | a1f9ed1d7d9e953833850a14405687e115bf0b82 (diff) | |
download | nextcloud-server-cb742e7045d1f5af7994ad1e918b0ddc9ba01914.tar.gz nextcloud-server-cb742e7045d1f5af7994ad1e918b0ddc9ba01914.zip |
Background job to cleanup leftover chunked uploads
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/dav/lib/Upload/UploadFolder.php')
-rw-r--r-- | apps/dav/lib/Upload/UploadFolder.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/dav/lib/Upload/UploadFolder.php b/apps/dav/lib/Upload/UploadFolder.php index b3d43fef95d..233c3ac3e52 100644 --- a/apps/dav/lib/Upload/UploadFolder.php +++ b/apps/dav/lib/Upload/UploadFolder.php @@ -22,16 +22,22 @@ */ namespace OCA\DAV\Upload; +use OCA\DAV\BackgroundJob\UploadCleanup; use OCA\DAV\Connector\Sabre\Directory; +use OCP\BackgroundJob\IJobList; use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\ICollection; class UploadFolder implements ICollection { + /** @var Directory */ private $node; + /** @var CleanupService */ + private $cleanupService; - function __construct(Directory $node) { + function __construct(Directory $node, CleanupService $cleanupService) { $this->node = $node; + $this->cleanupService = $cleanupService; } function createFile($name, $data = null) { @@ -65,6 +71,9 @@ class UploadFolder implements ICollection { function delete() { $this->node->delete(); + + // Background cleanup job is not needed anymore + $this->cleanupService->removeJob($this->getName()); } function getName() { |