From 471cad7d903958ea3b9da17486099e53e6a102f8 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sun, 6 May 2012 20:14:29 -0400 Subject: Remove manual file cache insertions of shared files, update mtime of shared folder --- apps/files_sharing/lib_share.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'apps') diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index d5cf3d0a1ba..c2340bdc181 100755 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -98,15 +98,8 @@ class OC_Share { $uid = $uid."@".$gid; } $query->execute(array($uid_owner, $uid, $source, $target, $permissions)); - // Add file to filesystem cache - $userDirectory = "/".OCP\USER::getUser()."/files"; - $data = OC_Filecache::get(substr($source, strlen($userDirectory))); - $parentQuery = OCP\DB::prepare('SELECT id FROM *PREFIX*fscache WHERE path=?'); - $parentResult = $parentQuery->execute(array($sharedFolder))->fetchRow(); - $parent = $parentResult['id']; - $is_writeable = $permissions & OC_Share::WRITE; - $cacheQuery = OCP\DB::prepare('INSERT INTO *PREFIX*fscache(parent, name, path, size, mtime, ctime, mimetype, mimepart, user, writable) VALUES(?,?,?,?,?,?,?,?,?,?)'); - $cacheQuery->execute(array($parent, basename($target), $target, $data['size'], $data['mtime'], $data['ctime'], $data['mimetype'], dirname($data['mimetype']), $uid, $is_writeable)); + // Update mtime of shared folder to invoke a file cache rescan + OC_Filesystem::getStorage($sharedFolder)->touch($sharedFolder); } } } @@ -383,6 +376,9 @@ class OC_Share { $source = self::cleanPath($source); $query = OCP\DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ? AND uid_shared_with ".self::getUsersAndGroups($uid_shared_with)); $query->execute(array(strlen($source), $source, OCP\USER::getUser())); + // Update mtime of shared folder to invoke a file cache rescan + $sharedFolder = '/'.$uid_shared_with.'/files/Shared'; + OC_Filesystem::getStorage($sharedFolder)->touch($sharedFolder); } /** -- cgit v1.2.3