[Pkg-owncloud-commits] [owncloud] 15/66: Remove the filecache for a users home storage when the user is deleted

David Prévot taffit at moszumanska.debian.org
Fri Apr 18 22:49:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v5.0.15
in repository owncloud.

commit 85ae5b992b69b93f1bfd140d4208d531f221ca83
Author: Robin Appelman <icewind at owncloud.com>
Date:   Wed Feb 12 14:14:38 2014 +0100

    Remove the filecache for a users home storage when the user is deleted
---
 lib/files/cache/cache.php | 20 ++++++++++++++++++++
 lib/user.php              |  4 ++++
 2 files changed, 24 insertions(+)

diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index a2a7a99..c8fa27e 100644
--- a/lib/files/cache/cache.php
+++ b/lib/files/cache/cache.php
@@ -85,6 +85,26 @@ class Cache {
 	}
 
 	/**
+	 * remove a storage from the cache
+	 *
+	 * @param string $storageId
+	 */
+	public static function removeStorage($storageId) {
+		$storageCache = new Cache($storageId);
+
+		\OC_DB::executeAudited('
+			DELETE FROM `*PREFIX*filecache` WHERE `storage` = ?',
+			array($storageCache->getNumericStorageId())
+		);
+
+		\OC_DB::executeAudited('
+			DELETE FROM `*PREFIX*storages` WHERE `numeric_id` = ?',
+			array($storageCache->getNumericStorageId())
+		);
+	}
+
+
+	/**
 	 * normalize mimetypes
 	 *
 	 * @param string $mime
diff --git a/lib/user.php b/lib/user.php
index 1bac483..e352a6b 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -221,6 +221,10 @@ class OC_User {
 			// Delete the user's keys in preferences
 			OC_Preferences::deleteUser($uid);
 
+			$home = self::getHome($uid);
+
+			\OC\Files\Cache\Cache::removeStorage('local::' . $home);
+
 			// Delete user files in /data/
 			OC_Helper::rmdirr(OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ) . '/'.$uid.'/');
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list