Better implementation of getting shared folder size by using the source path

This commit is contained in:
Michael Gapczynski 2011-06-24 19:52:35 -04:00
parent c8781b1caf
commit 78293ea244
1 changed files with 3 additions and 2 deletions

View File

@ -151,7 +151,8 @@ class OC_FILESTORAGE_SHARED {
if ($path == "" || $path == "/") { if ($path == "" || $path == "/") {
$dbpath = $_SESSION['user_id']."/files/Share/"; $dbpath = $_SESSION['user_id']."/files/Share/";
} else { } else {
$dbpath = substr(OC_SHARE::getSource($path), 1); $source = OC_SHARE::getSource($path);
$dbpath = $this->getInternalPath($source);
} }
$query = OC_DB::prepare("SELECT size FROM *PREFIX*foldersize WHERE path=?"); $query = OC_DB::prepare("SELECT size FROM *PREFIX*foldersize WHERE path=?");
$size = $query->execute(array($dbpath))->fetchAll(); $size = $query->execute(array($dbpath))->fetchAll();
@ -166,7 +167,7 @@ class OC_FILESTORAGE_SHARED {
$size = 0; $size = 0;
if ($dh = $this->opendir($path)) { if ($dh = $this->opendir($path)) {
while (($filename = readdir($dh)) != false) { while (($filename = readdir($dh)) != false) {
if ($this->is_file($filename)){ if ($this->is_file($filename)) {
$size += $this->filesize($filename); $size += $this->filesize($filename);
} else { } else {
$size += $this->getFolderSize($filename); $size += $this->getFolderSize($filename);