]> source.dussan.org Git - nextcloud-server.git/commitdiff
remove storage wrappers when deleting the user storage 32444/head
authorRobin Appelman <robin@icewind.nl>
Thu, 12 May 2022 12:40:20 +0000 (14:40 +0200)
committerVincent Petry (Rebase PR Action) <PVince81@users.noreply.github.com>
Fri, 10 Jun 2022 15:40:22 +0000 (15:40 +0000)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php

index fa7459e10ff977d0d825c67f301ee310f3531052..2fb05159d091f3208fd250748b542608de91284c 100644 (file)
@@ -26,6 +26,7 @@ declare(strict_types=1);
 namespace OC\Authentication\Listeners;
 
 use OC\Files\Cache\Cache;
+use OC\Files\Storage\Wrapper\Wrapper;
 use OCP\EventDispatcher\Event;
 use OCP\EventDispatcher\IEventListener;
 use OCP\Files\Config\IMountProviderCollection;
@@ -56,6 +57,13 @@ class UserDeletedFilesCleanupListener implements IEventListener {
                        if (!$storage) {
                                throw new \Exception("User has no home storage");
                        }
+
+                       // remove all wrappers, so we do the delete directly on the home storage bypassing any wrapper
+                       while ($storage->instanceOfStorage(Wrapper::class)) {
+                               /** @var Wrapper $storage */
+                               $storage = $storage->getWrapperStorage();
+                       }
+
                        $this->homeStorageCache[$event->getUser()->getUID()] = $storage;
                }
                if ($event instanceof UserDeletedEvent) {