summaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Cache/HomeCache.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files/Cache/HomeCache.php')
-rw-r--r--lib/private/Files/Cache/HomeCache.php34
1 files changed, 3 insertions, 31 deletions
diff --git a/lib/private/Files/Cache/HomeCache.php b/lib/private/Files/Cache/HomeCache.php
index cd6408a86f6..3b0eaae4c5d 100644
--- a/lib/private/Files/Cache/HomeCache.php
+++ b/lib/private/Files/Cache/HomeCache.php
@@ -35,7 +35,7 @@ class HomeCache extends Cache {
* get the size of a folder and set it in the cache
*
* @param string $path
- * @param array $entry (optional) meta data of the folder
+ * @param array|null|ICacheEntry $entry (optional) meta data of the folder
* @return int|float
*/
public function calculateFolderSize($path, $entry = null) {
@@ -44,37 +44,9 @@ class HomeCache extends Cache {
} elseif ($path === '' or $path === '/') {
// since the size of / isn't used (the size of /files is used instead) there is no use in calculating it
return 0;
+ } else {
+ return $this->calculateFolderSizeInner($path, $entry, true);
}
-
- $totalSize = 0;
- if (is_null($entry)) {
- $entry = $this->get($path);
- }
- if ($entry && $entry['mimetype'] === 'httpd/unix-directory') {
- $id = $entry['fileid'];
-
- $query = $this->connection->getQueryBuilder();
- $query->selectAlias($query->func()->sum('size'), 'f1')
- ->from('filecache')
- ->where($query->expr()->eq('parent', $query->createNamedParameter($id)))
- ->andWhere($query->expr()->eq('storage', $query->createNamedParameter($this->getNumericStorageId())))
- ->andWhere($query->expr()->gte('size', $query->createNamedParameter(0)));
-
- $result = $query->execute();
- $row = $result->fetch();
- $result->closeCursor();
-
- if ($row) {
- [$sum] = array_values($row);
- $totalSize = 0 + $sum;
- $entry['size'] += 0;
- if ($entry['size'] !== $totalSize) {
- $this->update($id, ['size' => $totalSize]);
- }
- }
- $result->closeCursor();
- }
- return $totalSize;
}
/**