From 45addd9bae18baed77b76668f7b8fa176e853b56 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 17 Apr 2019 22:46:43 +0200 Subject: [PATCH] Also delete objectstore data on user deletion As there is no local data we have to explictly delete the data from the objectstore. Now this might time out if you do it via web. Maybe we should add a warning there if you do not use local storage? Signed-off-by: Roeland Jago Douma --- lib/private/User/User.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 12af787a5a6e6..309d5a2080039 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -33,6 +33,7 @@ use OC\Accounts\AccountManager; use OC\Files\Cache\Storage; +use OC\Files\Storage\Local; use OC\Hooks\Emitter; use OC_Helper; use OCP\IAvatarManager; @@ -203,6 +204,7 @@ public function delete() { } // get the home now because it won't return it after user deletion $homePath = $this->getHome(); + $userRoot = \OC::$server->getUserFolder($this->getUID()); $result = $this->backend->deleteUser($this->uid); if ($result) { @@ -221,6 +223,11 @@ public function delete() { // Delete the user's keys in preferences \OC::$server->getConfig()->deleteAllUserValues($this->uid); + // Delete all files + if (!$userRoot->getStorage()->instanceOfStorage(Local::class)) { + $userRoot->delete(); + } + // Delete user files in /data/ if ($homePath !== false) { // FIXME: this operates directly on FS, should use View instead...