Skip to content
Snippets Groups Projects
Commit 937d1b29 authored by Michael Gapczynski's avatar Michael Gapczynski
Browse files

Retrieve all file dependent items when looking for file item type

parent 4c7fd8cd
No related branches found
No related tags found
No related merge requests found
......@@ -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
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
if ($includeCollections && !isset($item) && $collectionTypes = self::getCollectionItemTypes($itemType)) {
$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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment