From cd2421c7ee04e6d46481a1d0ae36387757b204fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas.mueller@tmit.eu>
Date: Tue, 24 Sep 2013 10:37:58 +0200
Subject: [PATCH] adding PHPDoc comments to getBackend ensure getChildren() is
 called on an instance of Share_Backend_Collection

---
 apps/files_sharing/lib/cache.php | 15 ++++++++++-----
 lib/public/share.php             |  4 ++--
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index 51e8713b97..123268e240 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -20,6 +20,7 @@
  */
 
 namespace OC\Files\Cache;
+use OCP\Share_Backend_Collection;
 
 /**
  * Metadata cache for shared files
@@ -320,13 +321,17 @@ class Shared_Cache extends Cache {
 	public function getAll() {
 		$ids = \OCP\Share::getItemsSharedWith('file', \OC_Share_Backend_File::FORMAT_GET_ALL);
 		$folderBackend = \OCP\Share::getBackend('folder');
-		foreach ($ids as $file) {
-			$children = $folderBackend->getChildren($file);
-			foreach ($children as $child) {
-				$ids[] = (int)$child['source'];
+		if ($folderBackend instanceof Share_Backend_Collection) {
+			foreach ($ids as $file) {
+				/** @var $folderBackend Share_Backend_Collection */
+				$children = $folderBackend->getChildren($file);
+				foreach ($children as $child) {
+					$ids[] = (int)$child['source'];
+				}
+
 			}
-			
 		}
+
 		return $ids;
 	}
 
diff --git a/lib/public/share.php b/lib/public/share.php
index 10922965ea..41f5ccbf40 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -745,8 +745,8 @@ class Share {
 
 	/**
 	* @brief Get the backend class for the specified item type
-	* @param string Item type
-	* @return Sharing backend object
+	* @param string $itemType
+	* @return Share_Backend
 	*/
 	public static function getBackend($itemType) {
 		if (isset(self::$backends[$itemType])) {
-- 
GitLab