Also remove the user's home storage from the storage table when deleting a user

This commit is contained in:
Robin Appelman 2014-01-21 23:58:48 +01:00
parent 9851727b0d
commit 374e3475c9
2 changed files with 16 additions and 0 deletions

View File

@ -70,4 +70,17 @@ class Storage {
return false; 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));
}
} }

View File

@ -205,6 +205,9 @@ class OC_User {
// Delete user files in /data/ // Delete user files in /data/
OC_Helper::rmdirr(\OC_User::getHome($uid)); 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 // Remove it from the Cache
self::getManager()->delete($uid); self::getManager()->delete($uid);
} }