summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-07-12 10:52:30 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-07-12 12:10:50 -0400
commitecae3ea43055055d39080a512f247f89be3c22df (patch)
tree5da220a6948c54bc7d1ef2cc5ac657433f280f90 /lib/public
parentbdcfa4bb63800093ad47520c9874fb837f9bf2e9 (diff)
downloadnextcloud-server-ecae3ea43055055d39080a512f247f89be3c22df.tar.gz
nextcloud-server-ecae3ea43055055d39080a512f247f89be3c22df.zip
Rename parents to collectionTypes, getCollectionItemTypes() shouldn't include the original item type
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/share.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index 7356714219a..a3ed7846b54 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -373,14 +373,15 @@ class Share {
* @return array
*/
private static function getCollectionItemTypes($itemType) {
- $collections = array($itemType);
+ $collectionTypes = array($itemType);
foreach (self::$backendTypes as $type => $backend) {
- if (in_array($backend['collectionOf'], $collections)) {
- $collections[] = $type;
+ if (in_array($backend['collectionOf'], $collectionTypes)) {
+ $collectionTypes[] = $type;
}
}
- if (count($collections) > 1) {
- return $collections;
+ if (count($collectionTypes) > 1) {
+ unset($collectionTypes[0]);
+ return $collectionTypes;
}
return false;
}
@@ -401,8 +402,9 @@ class Share {
private static function getItems($itemType, $item = null, $shareType = null, $shareWith = null, $uidOwner = null, $format = self::FORMAT_NONE, $parameters = null, $limit = -1, $isSource = false) {
if ($backend = self::getBackend($itemType)) {
// Check if there are any parent types that include this type of items, e.g. a music album contains songs
- if ($parents = self::getCollectionItemTypes($itemType)) {
- $where = "WHERE item_type IN ('".implode("','", $parents)."')";
+ if ($collectionTypes = self::getCollectionItemTypes($itemType)) {
+ $collectionTypes = array_merge(array($itemType), $collectionTypes);
+ $where = "WHERE item_type IN ('".implode("','", $collectionTypes)."')";
} else {
$where = "WHERE item_type = '".$itemType."'";
}
@@ -490,7 +492,7 @@ class Share {
}
$items[$item['id']] = $item;
// TODO Add in parent item types children?
- if ($parents && in_array($item['item_type'], $parents)) {
+ if ($collectionTypes && in_array($item['item_type'], $collectionTypes)) {
$children[] = $item;
}
}