]> source.dussan.org Git - nextcloud-server.git/commitdiff
set cache to failedcache when shared storage init fails 3953/head
authorRobin Appelman <robin@icewind.nl>
Thu, 23 Mar 2017 14:01:23 +0000 (15:01 +0100)
committerRobin Appelman <robin@icewind.nl>
Thu, 23 Mar 2017 14:01:23 +0000 (15:01 +0100)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_sharing/lib/SharedStorage.php
apps/files_sharing/tests/SharedStorageTest.php

index 2cfba16c686eaaf7b3ff062e3bca8f7aba04fc82..ddbc9b8a8984f0d9fa43fc4304cd6034398bf1ad 100644 (file)
@@ -124,13 +124,16 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto
                } catch (NotFoundException $e) {
                        // original file not accessible or deleted, set FailedStorage
                        $this->storage = new FailedStorage(['exception' => $e]);
+                       $this->cache = new FailedCache();
                        $this->rootPath = '';
                } catch (NoUserException $e) {
                        // sharer user deleted, set FailedStorage
                        $this->storage = new FailedStorage(['exception' => $e]);
+                       $this->cache = new FailedCache();
                        $this->rootPath = '';
                } catch (\Exception $e) {
                        $this->storage = new FailedStorage(['exception' => $e]);
+                       $this->cache = new FailedCache();
                        $this->rootPath = '';
                        $this->logger->logException($e);
                }
index ad6243c46b143bf203e39bbc962029c8eaf55da6..7d007cb64140977995527036ac68acf3348887bc 100644 (file)
@@ -577,8 +577,8 @@ class SharedStorageTest extends TestCase {
                ]);
 
                // trigger init
-               $this->assertInstanceOf(\OC\Files\Cache\FailedCache::class, $storage->getCache());
                $this->assertInstanceOf(\OC\Files\Storage\FailedStorage::class, $storage->getSourceStorage());
+               $this->assertInstanceOf(\OC\Files\Cache\FailedCache::class, $storage->getCache());
        }
 
        public function testInitWithNotFoundSource() {
@@ -594,7 +594,7 @@ class SharedStorageTest extends TestCase {
                ]);
 
                // trigger init
-               $this->assertInstanceOf(\OC\Files\Cache\FailedCache::class, $storage->getCache());
                $this->assertInstanceOf(\OC\Files\Storage\FailedStorage::class, $storage->getSourceStorage());
+               $this->assertInstanceOf(\OC\Files\Cache\FailedCache::class, $storage->getCache());
        }
 }