From 374e3475c9e2e0220cc8639a1a06f68b7f43fb2b Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 21 Jan 2014 23:58:48 +0100 Subject: Also remove the user's home storage from the storage table when deleting a user --- lib/private/files/cache/storage.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/private/files/cache') diff --git a/lib/private/files/cache/storage.php b/lib/private/files/cache/storage.php index 5657cf06e12..6d7a1002c1b 100644 --- a/lib/private/files/cache/storage.php +++ b/lib/private/files/cache/storage.php @@ -70,4 +70,17 @@ class Storage { return false; } } + + /** + * remove the entry for the storage + * + * @param string $storageId + */ + public static function remove($storageId) { + if (strlen($storageId) > 64) { + $storageId = md5($storageId); + } + $sql = 'DELETE FROM `*PREFIX*storages` WHERE `id` = ?'; + \OC_DB::executeAudited($sql, array($storageId)); + } } -- cgit v1.2.3 From 0ae4022fb4fc6ade3ed300205ccdcdd32863dcdc Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 3 Feb 2014 16:36:21 +0100 Subject: Also clean up the filecache table when deleting a storage entry --- lib/private/files/cache/storage.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/private/files/cache') diff --git a/lib/private/files/cache/storage.php b/lib/private/files/cache/storage.php index 6d7a1002c1b..5b1b30176e8 100644 --- a/lib/private/files/cache/storage.php +++ b/lib/private/files/cache/storage.php @@ -77,10 +77,16 @@ class 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)); } } -- cgit v1.2.3