Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.2] cache isLocal for shared storage #24841

Merged
merged 1 commit into from May 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions apps/files_sharing/lib/sharedstorage.php
Expand Up @@ -44,6 +44,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
private $share; // the shared resource
private $files = array();
private static $isInitialized = array();
private $local = null;

/**
* @var \OC\Files\View
Expand Down Expand Up @@ -705,9 +706,12 @@ public function setAvailability($available) {
}

public function isLocal() {
$this->init();
$ownerPath = $this->ownerView->getPath($this->share['item_source']);
list($targetStorage) = $this->ownerView->resolvePath($ownerPath);
return $targetStorage->isLocal();
if (!is_null($this->local)) {
$this->init();
$ownerPath = $this->ownerView->getPath($this->share['item_source']);
list($targetStorage) = $this->ownerView->resolvePath($ownerPath);
$this->local = $targetStorage->isLocal();
}
return $this->local;
}
}