summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-12-20 16:12:51 +0100
committerLukas Reschke <lukas@statuscode.ch>2016-12-23 12:42:31 +0100
commit91cd57e55b034ec3be06c5db8fb2a60bfdf3c749 (patch)
tree554c2eb5b1ed9a0bd953ec0ee6c51d1eca4fffb6 /lib
parent91c87d3a7a219101abdb14c096a15587b79e5bea (diff)
downloadnextcloud-server-91cd57e55b034ec3be06c5db8fb2a60bfdf3c749.tar.gz
nextcloud-server-91cd57e55b034ec3be06c5db8fb2a60bfdf3c749.zip
Get user home folder before deletion
After the deletion getHome() will fail because the user doesn't exist any more, so we need to fetch that value earlier. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/User/User.php8
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);