diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-03-11 13:04:20 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-03-11 13:04:20 +0100 |
commit | d55c7223a96e259543d28f53474a17525fdac25f (patch) | |
tree | c2acd009ea815b0df04d608235a785990cea3f4d /lib/private/files/cache/homecache.php | |
parent | 06c6163265bf10e7aa84c2621d58323b3ad94963 (diff) | |
parent | c1cb9ee9b0b19e17ddde046642fa01d52cda63bf (diff) | |
download | nextcloud-server-d55c7223a96e259543d28f53474a17525fdac25f.tar.gz nextcloud-server-d55c7223a96e259543d28f53474a17525fdac25f.zip |
Merge branch 'master' into foldersize-reuse
Conflicts:
lib/private/files/cache/homecache.php
Diffstat (limited to 'lib/private/files/cache/homecache.php')
-rw-r--r-- | lib/private/files/cache/homecache.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/private/files/cache/homecache.php b/lib/private/files/cache/homecache.php index fad39a7fdad..2326c46e8d0 100644 --- a/lib/private/files/cache/homecache.php +++ b/lib/private/files/cache/homecache.php @@ -17,7 +17,7 @@ class HomeCache extends Cache { * @return int */ public function calculateFolderSize($path, $entry = null) { - if ($path !== '/' and $path !== '' and $path !== 'files') { + if ($path !== '/' and $path !== '' and $path !== 'files' and $path !== 'files_trashbin') { return parent::calculateFolderSize($path, $entry); } 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 @@ -30,15 +30,20 @@ class HomeCache extends Cache { } if ($entry && $entry['mimetype'] === 'httpd/unix-directory') { $id = $entry['fileid']; - $sql = 'SELECT SUM(`size`) FROM `*PREFIX*filecache` ' . + $sql = 'SELECT SUM(`size`) AS f1, ' . + 'SUM(`unencrypted_size`) AS f2 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) = array_values($row); + list($sum, $unencryptedSum) = array_values($row); $totalSize = (int)$sum; + $unencryptedSize = (int)$unencryptedSum; if ($entry['size'] !== $totalSize) { $this->update($id, array('size' => $totalSize)); } + if ($entry['unencrypted_size'] !== $unencryptedSize) { + $this->update($id, array('unencrypted_size' => $unencryptedSize)); + } } } return $totalSize; |