From: Robin Appelman Date: Thu, 12 May 2022 12:40:20 +0000 (+0200) Subject: remove storage wrappers when deleting the user storage X-Git-Tag: v25.0.0beta1~404^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F32357%2Fhead;p=nextcloud-server.git remove storage wrappers when deleting the user storage Signed-off-by: Robin Appelman --- diff --git a/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php b/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php index fa7459e10ff..2fb05159d09 100644 --- a/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php +++ b/lib/private/Authentication/Listeners/UserDeletedFilesCleanupListener.php @@ -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) {