]> source.dussan.org Git - nextcloud-server.git/commitdiff
dont use the source cache/storage until needed
authorRobin Appelman <robin@icewind.nl>
Thu, 17 Nov 2016 13:18:08 +0000 (14:18 +0100)
committerRobin Appelman <robin@icewind.nl>
Thu, 17 Nov 2016 17:48:38 +0000 (18:48 +0100)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_sharing/lib/Cache.php

index 21f3ff622f9256bff1706ac0158d94fc02ba7aa3..49765a7aab5566d1dd697760b94488ae62442175 100644 (file)
@@ -42,39 +42,33 @@ class Cache extends CacheJail {
         */
        private $storage;
 
-       /**
-        * @var IStorage
-        */
-       private $sourceStorage;
-
        /**
         * @var ICacheEntry
         */
        private $sourceRootInfo;
 
-       /**
-        * @var \OCP\Files\Cache\ICache
-        */
-       private $sourceCache;
-
        private $rootUnchanged = true;
 
        /**
         * @param \OCA\Files_Sharing\SharedStorage $storage
-        * @param IStorage $sourceStorage
         * @param ICacheEntry $sourceRootInfo
         */
-       public function __construct($storage, IStorage $sourceStorage, ICacheEntry $sourceRootInfo) {
+       public function __construct($storage, ICacheEntry $sourceRootInfo) {
                $this->storage = $storage;
-               $this->sourceStorage = $sourceStorage;
                $this->sourceRootInfo = $sourceRootInfo;
-               $this->sourceCache = $sourceStorage->getCache();
                parent::__construct(
-                       $this->sourceCache,
+                       null,
                        $this->sourceRootInfo->getPath()
                );
        }
 
+       public function getCache() {
+               if (is_null($this->cache)) {
+                       $this->cache = $this->storage->getSourceStorage()->getCache();
+               }
+               return $this->cache;
+       }
+
        public function getNumericStorageId() {
                if (isset($this->numericId)) {
                        return $this->numericId;