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
This commit is contained in:
Vincent Petry 2014-02-10 15:04:05 +01:00
commit bea80ffe20
2 changed files with 22 additions and 0 deletions

View File

@ -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));
}
}

View File

@ -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);
}