Skip to content
Snippets Groups Projects
Commit bea80ffe authored by Vincent Petry's avatar Vincent Petry
Browse files

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
parents 14d1abf6 5ffc43cb
Branches
No related tags found
No related merge requests found
......@@ -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));
}
}
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment