diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-10-29 15:50:33 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-10-29 15:50:33 +0100 |
commit | f021dad204afab2977417265f121d660d3d71252 (patch) | |
tree | 6f5a574e3c3f61754439b7d529bcecf22c052464 /lib/private/user.php | |
parent | b0b76fe064860d2074c91897a29e0f9ac5705db8 (diff) | |
download | nextcloud-server-f021dad204afab2977417265f121d660d3d71252.tar.gz nextcloud-server-f021dad204afab2977417265f121d660d3d71252.zip |
remove user from cache if he was deleted successfully
Diffstat (limited to 'lib/private/user.php')
-rw-r--r-- | lib/private/user.php | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/private/user.php b/lib/private/user.php index 6b350d4cf1b..710f0fd66db 100644 --- a/lib/private/user.php +++ b/lib/private/user.php @@ -187,18 +187,25 @@ class OC_User { public static function deleteUser($uid) { $user = self::getManager()->get($uid); if ($user) { - $user->delete(); + $result = $user->delete(); - // We have to delete the user from all groups - foreach (OC_Group::getUserGroups($uid) as $i) { - OC_Group::removeFromGroup($uid, $i); + // if delete was successful we clean-up the rest + if ($result) { + + // We have to delete the user from all groups + foreach (OC_Group::getUserGroups($uid) as $i) { + OC_Group::removeFromGroup($uid, $i); + } + // Delete the user's keys in preferences + OC_Preferences::deleteUser($uid); + + // Delete user files in /data/ + OC_Helper::rmdirr(OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $uid . '/'); + + // Remove it from the Cache + self::getManager()->delete($uid); } - // Delete the user's keys in preferences - OC_Preferences::deleteUser($uid); - // Delete user files in /data/ - OC_Helper::rmdirr(OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $uid . '/'); - return true; } else { return false; |