mirror of
https://github.com/nextcloud/server.git
synced 2026-04-20 22:00:39 -04:00
Merge pull request #32357 from nextcloud/user-delete-remove-wrappers
remove storage wrappers when deleting the user storage
This commit is contained in:
commit
778db45631
1 changed files with 8 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue