diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-09-08 23:07:43 -0400 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-09-08 23:09:57 -0400 |
commit | b163bd514f65999cd8aa66262d10ca92dcdf99d1 (patch) | |
tree | fdda277cf4d0b7c8918258714f2e1ab8849faf72 /apps/files_sharing/lib | |
parent | a050915167cdcb0f5b99d5c0007ed9f9f25a20de (diff) | |
download | nextcloud-server-b163bd514f65999cd8aa66262d10ca92dcdf99d1.tar.gz nextcloud-server-b163bd514f65999cd8aa66262d10ca92dcdf99d1.zip |
Fix fetching shared children items, fixes problem with displaying owner of a shared file inside a shared folder
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/share/folder.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/share/folder.php b/apps/files_sharing/lib/share/folder.php index 665583e83ad..e29e9b7e002 100644 --- a/apps/files_sharing/lib/share/folder.php +++ b/apps/files_sharing/lib/share/folder.php @@ -19,7 +19,7 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ -class OC_Share_Backend_Folder extends OC_Share_Backend_File { +class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share_Backend_Collection { public function formatItems($items, $format, $parameters = null) { if ($format == self::FORMAT_SHARED_STORAGE) { @@ -50,12 +50,22 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File { } public function getChildren($itemSource) { - $files = OC_FileCache::getFolderContent($itemSource); - $sources = array(); - foreach ($files as $file) { - $sources[] = $file['path']; + $children = array(); + $parents = array($itemSource); + while (!empty($parents)) { + $parents = "'".implode("','", $parents)."'"; + $query = OC_DB::prepare('SELECT `id`, `name`, `mimetype` FROM `*PREFIX*fscache` WHERE `parent` IN ('.$parents.')'); + $result = $query->execute(); + $parents = array(); + while ($file = $result->fetchRow()) { + $children[] = array('source' => $file['id'], 'file_path' => $file['name']); + // If a child folder is found look inside it + if ($file['mimetype'] == 'httpd/unix-directory') { + $parents[] = $file['id']; + } + } } - return $sources; + return $children; } }
\ No newline at end of file |