1
0

CleanupService.php 747 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\DAV\Upload;
  8. use OCA\DAV\BackgroundJob\UploadCleanup;
  9. use OCP\BackgroundJob\IJobList;
  10. use OCP\IUserSession;
  11. class CleanupService {
  12. public function __construct(
  13. private IUserSession $userSession,
  14. private IJobList $jobList,
  15. ) {
  16. }
  17. public function addJob(string $folder) {
  18. $this->jobList->add(UploadCleanup::class, ['uid' => $this->userSession->getUser()->getUID(), 'folder' => $folder]);
  19. }
  20. public function removeJob(string $folder) {
  21. $this->jobList->remove(UploadCleanup::class, ['uid' => $this->userSession->getUser()->getUID(), 'folder' => $folder]);
  22. }
  23. }