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

Fix shared storage recursive setup #1007

Merged
merged 6 commits into from
Aug 23, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Lazy init shared storage
icewind1991 committed Aug 22, 2016
commit 3ed01e845994192cae29c81024ec1921a96ec31d
26 changes: 9 additions & 17 deletions apps/files_sharing/lib/sharedstorage.php
Original file line number Diff line number Diff line change
@@ -61,11 +61,6 @@ class Shared extends \OC\Files\Storage\Wrapper\Jail implements ISharedStorage {
*/
private $sourceRootInfo;

/**
* @var IStorage
*/
private $sourceStorage;

/** @var string */
private $user;

@@ -83,13 +78,9 @@ public function __construct($arguments) {

$this->user = $arguments['user'];

Filesystem::initMountPoints($this->superShare->getShareOwner());
$sourcePath = $this->ownerView->getPath($this->superShare->getNodeId());
list($storage, $internalPath) = $this->ownerView->resolvePath($sourcePath);

parent::__construct([
'storage' => $storage,
'root' => $internalPath,
'storage' => null,
'root' => null,
]);
}

@@ -101,8 +92,8 @@ private function init() {
try {
Filesystem::initMountPoints($this->superShare->getShareOwner());
$sourcePath = $this->ownerView->getPath($this->superShare->getNodeId());
list($this->sourceStorage, $sourceInternalPath) = $this->ownerView->resolvePath($sourcePath);
$this->sourceRootInfo = $this->sourceStorage->getCache()->get($sourceInternalPath);
list($this->storage, $this->rootPath) = $this->ownerView->resolvePath($sourcePath);
$this->sourceRootInfo = $this->storage->getCache()->get($this->rootPath);
} catch (\Exception $e) {
$this->logger->logException($e);
}
@@ -302,13 +293,13 @@ public function getItemType() {

public function getCache($path = '', $storage = null) {
$this->init();
if (is_null($this->sourceStorage)) {
if (is_null($this->storage)) {
return new FailedCache(false);
}
if (!$storage) {
$storage = $this;
}
return new \OCA\Files_Sharing\Cache($storage, $this->sourceStorage, $this->sourceRootInfo);
return new \OCA\Files_Sharing\Cache($storage, $this->storage, $this->sourceRootInfo);
}

public function getScanner($path = '', $storage = null) {
@@ -408,8 +399,9 @@ public function setAvailability($available) {
// shares do not participate in availability logic
}

public function getSourceStorage() {
return $this->sourceStorage;
public function getWrapperStorage() {
$this->init();
return $this->storage;
}

public function file_get_contents($path) {