set cache to failedcache when shared storage init fails

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2017-03-23 15:01:23 +01:00 committed by Lukas Reschke
parent 0d20865548
commit 1fd6369a60
No known key found for this signature in database
GPG Key ID: B9F6980CF6E759B1
2 changed files with 5 additions and 2 deletions

View 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);
}

View 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());
}
}