diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-02-10 15:04:05 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-02-10 15:04:05 +0100 |
commit | bea80ffe2060407e5d849a86f71fae2eed80b08e (patch) | |
tree | 951538ab781210fe12a696d942772fb31a28d947 /lib | |
parent | 14d1abf63f88943d376b29e31ac04265456db2a4 (diff) | |
parent | 5ffc43cba022de3b4e60b3525f3a263699dfe2f5 (diff) | |
download | nextcloud-server-bea80ffe2060407e5d849a86f71fae2eed80b08e.tar.gz nextcloud-server-bea80ffe2060407e5d849a86f71fae2eed80b08e.zip |
Merge pull request #6881 from owncloud/remove-user-storage-entry
Also remove the user's home storage from the storage table when deleting a user
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/cache/storage.php | 19 | ||||
-rw-r--r-- | lib/private/user.php | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/private/files/cache/storage.php b/lib/private/files/cache/storage.php index 5657cf06e12..5b1b30176e8 100644 --- a/lib/private/files/cache/storage.php +++ b/lib/private/files/cache/storage.php @@ -70,4 +70,23 @@ class Storage { return false; } } + + /** + * remove the entry for the storage + * + * @param string $storageId + */ + public static function remove($storageId) { + $storageCache = new Storage($storageId); + $numericId = $storageCache->getNumericId(); + + if (strlen($storageId) > 64) { + $storageId = md5($storageId); + } + $sql = 'DELETE FROM `*PREFIX*storages` WHERE `id` = ?'; + \OC_DB::executeAudited($sql, array($storageId)); + + $sql = 'DELETE FROM `*PREFIX*filecache` WHERE `storage` = ?'; + \OC_DB::executeAudited($sql, array($numericId)); + } } diff --git a/lib/private/user.php b/lib/private/user.php index 98ebebbe5c1..2519200d0f0 100644 --- a/lib/private/user.php +++ b/lib/private/user.php @@ -205,6 +205,9 @@ class OC_User { // Delete user files in /data/ OC_Helper::rmdirr(\OC_User::getHome($uid)); + // Delete the users entry in the storage table + \OC\Files\Cache\Storage::remove('home::' . $uid); + // Remove it from the Cache self::getManager()->delete($uid); } |