Merge pull request #5464 from nextcloud/shared-cache-during-init-11

[11] dont die if we try to access the shared cache while setting up the shared storage
This commit is contained in:
Morris Jobke 2017-07-13 22:37:52 +02:00 committed by GitHub
commit 7b70c4000b
1 changed files with 8 additions and 1 deletions

View File

@ -27,6 +27,7 @@
namespace OCA\Files_Sharing;
use OC\Files\Cache\FailedCache;
use OC\Files\Cache\Wrapper\CacheJail;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\Storage\IStorage;
@ -66,7 +67,13 @@ class Cache extends CacheJail {
public function getCache() {
if (is_null($this->cache)) {
$this->cache = $this->storage->getSourceStorage()->getCache();
$sourceStorage = $this->storage->getSourceStorage();
if ($sourceStorage) {
$this->cache = $sourceStorage->getCache();
} else {
// don't set $this->cache here since sourceStorage will be set later
return new FailedCache();
}
}
return $this->cache;
}