From 053edde780204ac40839b39b2d2ee0514830fabc Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Mon, 27 Jun 2011 12:53:10 -0400 Subject: [PATCH] Improvements to caching for shared folders --- apps/files_sharing/sharedstorage.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index f7f156c760b..e17685a09e7 100644 --- a/apps/files_sharing/sharedstorage.php +++ b/apps/files_sharing/sharedstorage.php @@ -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; + } } }