Skip to content

Commit

Permalink
Merge pull request #5464 from nextcloud/shared-cache-during-init-11
Browse files Browse the repository at this point in the history
[11] dont die if we try to access the shared cache while setting up the shared storage
  • Loading branch information
MorrisJobke authored Jul 13, 2017
2 parents 2954bc8 + 3758eb8 commit 7b70c40
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/files_sharing/lib/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -66,7 +67,13 @@ public function __construct($storage, ICacheEntry $sourceRootInfo) {

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;
}
Expand Down

0 comments on commit 7b70c40

Please sign in to comment.