diff options
Diffstat (limited to 'apps/files_trashbin/lib/Command/Expire.php')
-rw-r--r-- | apps/files_trashbin/lib/Command/Expire.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/apps/files_trashbin/lib/Command/Expire.php b/apps/files_trashbin/lib/Command/Expire.php new file mode 100644 index 00000000000..73a42cd4749 --- /dev/null +++ b/apps/files_trashbin/lib/Command/Expire.php @@ -0,0 +1,39 @@ +<?php + +/** + * SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only + */ +namespace OCA\Files_Trashbin\Command; + +use OC\Command\FileAccess; +use OCA\Files_Trashbin\Trashbin; +use OCP\Command\ICommand; +use OCP\IUserManager; +use OCP\Server; + +class Expire implements ICommand { + use FileAccess; + + /** + * @param string $user + */ + public function __construct( + private $user, + ) { + } + + public function handle() { + $userManager = Server::get(IUserManager::class); + if (!$userManager->userExists($this->user)) { + // User has been deleted already + return; + } + + \OC_Util::tearDownFS(); + \OC_Util::setupFS($this->user); + Trashbin::expire($this->user); + \OC_Util::tearDownFS(); + } +} |