diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-12-27 13:45:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-27 13:45:28 +0100 |
commit | f237c582ba5232d0b73c2a2a0cb15101f06697d0 (patch) | |
tree | 296ef7e6ad455248d279556b3481210cd10acf53 /lib | |
parent | bd20139f55bbf4871024579994c687d105df3e9c (diff) | |
parent | 91cd57e55b034ec3be06c5db8fb2a60bfdf3c749 (diff) | |
download | nextcloud-server-f237c582ba5232d0b73c2a2a0cb15101f06697d0.tar.gz nextcloud-server-f237c582ba5232d0b73c2a2a0cb15101f06697d0.zip |
Merge pull request #2845 from nextcloud/deleteuser-gethomeearly
Get user home folder before deletion
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/User/User.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 3cc6dc3b7ed..4b37efe0705 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -197,6 +197,8 @@ class User implements IUser { if ($this->emitter) { $this->emitter->emit('\OC\User', 'preDelete', array($this)); } + // get the home now because it won't return it after user deletion + $homePath = $this->getHome(); $result = $this->backend->deleteUser($this->uid); if ($result) { @@ -210,7 +212,11 @@ class User implements IUser { \OC::$server->getConfig()->deleteAllUserValues($this->uid); // Delete user files in /data/ - \OC_Helper::rmdirr($this->getHome()); + if ($homePath !== false) { + // FIXME: this operates directly on FS, should use View instead... + // also this is not testable/mockable... + \OC_Helper::rmdirr($homePath); + } // Delete the users entry in the storage table Storage::remove('home::' . $this->uid); |