Expire.php 804 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. * @var string
  15. */
  16. private $user;
  17. /**
  18. * @param string $user
  19. */
  20. public function __construct($user) {
  21. $this->user = $user;
  22. }
  23. public function handle() {
  24. $userManager = \OC::$server->getUserManager();
  25. if (!$userManager->userExists($this->user)) {
  26. // User has been deleted already
  27. return;
  28. }
  29. \OC_Util::tearDownFS();
  30. \OC_Util::setupFS($this->user);
  31. Trashbin::expire($this->user);
  32. \OC_Util::tearDownFS();
  33. }
  34. }