diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-03-07 11:00:22 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-03-07 11:00:22 +0100 |
commit | 7f24d42ca5f70e5ed48cf800f0a8f134b9445d2e (patch) | |
tree | 32b8275c17451b14eebd65d037db716362c95eb6 /lib/private/files/cache/homecache.php | |
parent | 536c33895f3e721492e30b19e02e4f1889207d34 (diff) | |
download | nextcloud-server-7f24d42ca5f70e5ed48cf800f0a8f134b9445d2e.tar.gz nextcloud-server-7f24d42ca5f70e5ed48cf800f0a8f134b9445d2e.zip |
Propagate unencrypted_size up to the file cache root
Diffstat (limited to 'lib/private/files/cache/homecache.php')
-rw-r--r-- | lib/private/files/cache/homecache.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/private/files/cache/homecache.php b/lib/private/files/cache/homecache.php index a7c310a3782..2af5b03c6e1 100644 --- a/lib/private/files/cache/homecache.php +++ b/lib/private/files/cache/homecache.php @@ -24,15 +24,20 @@ class HomeCache extends Cache { $entry = $this->get($path); 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; |