summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-14 11:02:29 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-14 11:02:29 -0400
commit937d1b29d8fedff9de3bfe07bcddbd4bc556a5cc (patch)
treea8b3fa53dbfa36b7328f478295cd226ee75d6b7c /lib/public
parent4c7fd8cd0191871e48704f693f48554d4ee7a726 (diff)
downloadnextcloud-server-937d1b29d8fedff9de3bfe07bcddbd4bc556a5cc.tar.gz
nextcloud-server-937d1b29d8fedff9de3bfe07bcddbd4bc556a5cc.zip
Retrieve all file dependent items when looking for file item type
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/share.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index cead8396a43..a97ecff60e7 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -448,9 +448,16 @@ class Share {
private static function getItems($itemType, $item = null, $shareType = null, $shareWith = null, $uidOwner = null, $format = self::FORMAT_NONE, $parameters = null, $limit = -1, $includeCollections = false, $itemShareWithBySource = false) {
$backend = self::getBackend($itemType);
// Get filesystem root to add it to the file target and remove from the file source
- $root = \OC_Filesystem::getRoot();
- // If includeCollections is true, find collections of this item type, e.g. a music album contains songs
- if ($includeCollections && !isset($item) && $collectionTypes = self::getCollectionItemTypes($itemType)) {
+ if ($backend instanceof Share_Backend_File_Dependent) {
+ $root = \OC_Filesystem::getRoot();
+ } else {
+ $root = '';
+ }
+ if ($itemType == 'file' && !isset($item)) {
+ $where = 'WHERE file_target IS NOT NULL';
+ $query_args = array();
+ } else if ($includeCollections && !isset($item) && $collectionTypes = self::getCollectionItemTypes($itemType)) {
+ // If includeCollections is true, find collections of this item type, e.g. a music album contains songs
$item_types = array_merge(array($itemType), $collectionTypes);
$placeholders = join(',', array_fill(0, count($item_types), '?'));
$where = "WHERE item_type IN ('".$placeholders."')";
@@ -574,7 +581,7 @@ class Share {
}
// TODO Check this outside of the loop
// Check if this is a collection of the requested item type
- if ($row['item_type'] != $itemType) {
+ if ($row['item_type'] != $itemType && $itemType != 'file' && !isset($item)) {
if ($collectionBackend = self::getBackend($row['item_type'])) {
$row['collection'] = array('item_type' => $itemType, $column => $row[$column]);
// Fetch all of the children sources