diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2012-05-06 20:14:29 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2012-05-06 20:14:29 -0400 |
commit | 471cad7d903958ea3b9da17486099e53e6a102f8 (patch) | |
tree | baaa92f7aa8e26e515ce84061fc21678d813ca06 | |
parent | aa0c3ddcfe2e0600d88dd40a89b42a908c9fbf83 (diff) | |
download | nextcloud-server-471cad7d903958ea3b9da17486099e53e6a102f8.tar.gz nextcloud-server-471cad7d903958ea3b9da17486099e53e6a102f8.zip |
Remove manual file cache insertions of shared files, update mtime of shared folder
-rwxr-xr-x | apps/files_sharing/lib_share.php | 14 |
1 files changed, 5 insertions, 9 deletions
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); } /** |