Skip to content

Commit

Permalink
Merge pull request #32445 from nextcloud/backport/32357/stable23
Browse files Browse the repository at this point in the history
[stable23] remove storage wrappers when deleting the user storage
  • Loading branch information
blizzz authored Jun 12, 2022
2 parents c66ad2c + 4055174 commit d2bd065
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
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;
Expand Down Expand Up @@ -56,6 +57,13 @@ public function handle(Event $event): void {
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) {
Expand Down

0 comments on commit d2bd065

Please sign in to comment.