diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2012-02-17 21:56:20 -0500 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2012-02-17 21:56:20 -0500 |
commit | 6f1ed85f0b6a7e675951a587f1308211b698a6d5 (patch) | |
tree | bbfb6ae4eb1acab5babad57850a1a557e97adea4 /apps/files_sharing | |
parent | 1fa05894d51235a46cf67812227d5e8363f87d54 (diff) | |
download | nextcloud-server-6f1ed85f0b6a7e675951a587f1308211b698a6d5.tar.gz nextcloud-server-6f1ed85f0b6a7e675951a587f1308211b698a6d5.zip |
Temporary fix for sharing files
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/lib_share.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index 049a74278b3..42739bdfba9 100644 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -88,12 +88,15 @@ class OC_Share { $uid = $uid."@".$gid; } $query->execute(array($uid_owner, $uid, $source, $target, $permissions)); - // Clear the folder size cache for the 'Shared' folder -// $clearFolderSize = OC_DB::prepare("DELETE FROM *PREFIX*foldersize WHERE path = ?"); -// $clearFolderSize->execute(array($sharedFolder)); - // Emit post_create and post_write hooks to notify of a new file in the user's filesystem - OC_Hook::emit("OC_Filesystem", "post_create", array('path' => $target)); - OC_Hook::emit("OC_Filesystem", "post_write", array('path' => $target)); + // Add file to filesystem cache + $userDirectory = "/".OC_User::getUser()."/files"; + $data = OC_Filecache::get(substr($source, strlen($userDirectory))); + $parentQuery = OC_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 = OC_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)); } } } |