summaryrefslogtreecommitdiffstats
path: root/lib/private/files/cache/cache.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/files/cache/cache.php')
-rw-r--r--lib/private/files/cache/cache.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 9b18257088c..abc11e76470 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -498,9 +498,10 @@ class Cache {
* update the folder size and the size of all parent folders
*
* @param string|boolean $path
+ * @param array $data (optional) meta data of the folder
*/
- public function correctFolderSize($path) {
- $this->calculateFolderSize($path);
+ public function correctFolderSize($path, $data = null) {
+ $this->calculateFolderSize($path, $data);
if ($path !== '') {
$parent = dirname($path);
if ($parent === '.' or $parent === '/') {
@@ -514,11 +515,14 @@ class 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
* @return int
*/
- public function calculateFolderSize($path) {
+ public function calculateFolderSize($path, $entry = null) {
$totalSize = 0;
- $entry = $this->get($path);
+ if (is_null($entry) or !isset($entry['fileid'])) {
+ $entry = $this->get($path);
+ }
if ($entry && $entry['mimetype'] === 'httpd/unix-directory') {
$id = $entry['fileid'];
$sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2, ' .
@@ -540,7 +544,7 @@ class Cache {
if ($entry['size'] !== $totalSize) {
$update['size'] = $totalSize;
}
- if ($entry['unencrypted_size'] !== $unencryptedSum) {
+ if (!isset($entry['unencrypted_size']) or $entry['unencrypted_size'] !== $unencryptedSum) {
$update['unencrypted_size'] = $unencryptedSum;
}
if (count($update) > 0) {