diff options
-rw-r--r-- | lib/private/files/cache/homecache.php | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/lib/private/files/cache/homecache.php b/lib/private/files/cache/homecache.php index 4439896e6e7..4b14bd12190 100644 --- a/lib/private/files/cache/homecache.php +++ b/lib/private/files/cache/homecache.php @@ -16,31 +16,23 @@ class HomeCache extends Cache { * @return int */ public function calculateFolderSize($path) { + if ($path !== '/' and $path !== '') { + return parent::calculateFolderSize($path); + } + $totalSize = 0; $entry = $this->get($path); if ($entry && $entry['mimetype'] === 'httpd/unix-directory') { - $isRoot = ($path === '/' or $path === ''); $id = $entry['fileid']; - $sql = 'SELECT SUM(`size`), MIN(`size`) FROM `*PREFIX*filecache` ' . - 'WHERE `parent` = ? AND `storage` = ?'; - if ($isRoot) { - // filter out non-scanned dirs at the root - $sql .= ' AND `size` >= 0'; - } + $sql = 'SELECT SUM(`size`) FROM `*PREFIX*filecache` ' . + 'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0'; $result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId())); if ($row = $result->fetchRow()) { - list($sum, $min) = array_values($row); - $sum = (int)$sum; - $min = (int)$min; - if ($min === -1) { - $totalSize = $min; - } else { - $totalSize = $sum; - } + list($sum) = array_values($row); + $totalSize = (int)$sum; if ($entry['size'] !== $totalSize) { $this->update($id, array('size' => $totalSize)); } - } } return $totalSize; |