1
0

Expire.php 752 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\Files_Trashbin\Command;
  8. use OC\Command\FileAccess;
  9. use OCA\Files_Trashbin\Trashbin;
  10. use OCP\Command\ICommand;
  11. class Expire implements ICommand {
  12. use FileAccess;
  13. /**
  14. * @param string $user
  15. */
  16. public function __construct(
  17. private $user,
  18. ) {
  19. }
  20. public function handle() {
  21. $userManager = \OC::$server->getUserManager();
  22. if (!$userManager->userExists($this->user)) {
  23. // User has been deleted already
  24. return;
  25. }
  26. \OC_Util::tearDownFS();
  27. \OC_Util::setupFS($this->user);
  28. Trashbin::expire($this->user);
  29. \OC_Util::tearDownFS();
  30. }
  31. }