]> source.dussan.org Git - nextcloud-server.git/commitdiff
adding PHPDoc comments to getBackend
authorThomas Müller <thomas.mueller@tmit.eu>
Tue, 24 Sep 2013 08:37:58 +0000 (10:37 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 24 Sep 2013 08:37:58 +0000 (10:37 +0200)
ensure getChildren() is called on an instance of Share_Backend_Collection

apps/files_sharing/lib/cache.php
lib/public/share.php

index 51e8713b97a96a999db7ecbb1010a66d7d547d37..123268e240afee61b59c179df4166e631a9d6eaa 100644 (file)
@@ -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;
        }
 
index 10922965ea83e4bbcc65b155161018579ef0bd52..41f5ccbf40d7d2651217cd504e98bf682eae93ec 100644 (file)
@@ -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])) {