Improvements to caching for shared folders

This commit is contained in:
Michael Gapczynski 2011-06-27 12:53:10 -04:00
parent a402c8ffe1
commit 053edde780
1 changed files with 14 additions and 5 deletions

View File

@ -43,13 +43,22 @@ class OC_FILESTORAGE_SHARED {
}
public function getSource($target) {
print_r($this->sourcePaths);
if (array_key_exists($target, $this->sourcePaths)) {
if ($target == "") {
return false;
} elseif (array_key_exists($target, $this->sourcePaths)) {
return $this->sourcePaths[$target];
} else {
$source = OC_SHARE::getSource($target);
$this->sourcePaths[$target] = $source;
return $source;
$parentDir = dirname($target);
if ($parentDir != ".") {
$source = $this->getSource($parentDir);
return $source."/".basename($target);
} else {
$source = OC_SHARE::getSource($target);
if ($source) {
$this->sourcePaths[$target] = $source;
}
return $source;
}
}
}