summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFlorin Peter <github@florin-peter.de>2013-04-25 15:20:06 +0200
committerFlorin Peter <github@florin-peter.de>2013-04-25 15:20:06 +0200
commitfac288a4ad8f6db907c0a2ddfeb0b772fe616db5 (patch)
treea359754e9d6b746d706bd81b7bf9308ad7949740 /lib
parent170d09203f376fad452fc6959729a0f778b5934f (diff)
downloadnextcloud-server-fac288a4ad8f6db907c0a2ddfeb0b772fe616db5.tar.gz
nextcloud-server-fac288a4ad8f6db907c0a2ddfeb0b772fe616db5.zip
added unencrypted file size to file cache
improved file size calculation and speeds
Diffstat (limited to 'lib')
-rw-r--r--lib/files/cache/cache.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index 71b70abe3fe..4e32ff2ba8a 100644
--- a/lib/files/cache/cache.php
+++ b/lib/files/cache/cache.php
@@ -117,7 +117,7 @@ class Cache {
$params = array($file);
}
$query = \OC_DB::prepare(
- 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`
+ 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `unencrypted_size`, `etag`
FROM `*PREFIX*filecache` ' . $where);
$result = $query->execute($params);
$data = $result->fetchRow();
@@ -133,6 +133,7 @@ class Cache {
$data['size'] = (int)$data['size'];
$data['mtime'] = (int)$data['mtime'];
$data['encrypted'] = (bool)$data['encrypted'];
+ $data['unencrypted_size'] = (int)$data['unencrypted_size'];
$data['storage'] = $this->storageId;
$data['mimetype'] = $this->getMimetype($data['mimetype']);
$data['mimepart'] = $this->getMimetype($data['mimepart']);
@@ -151,7 +152,7 @@ class Cache {
$fileId = $this->getId($folder);
if ($fileId > -1) {
$query = \OC_DB::prepare(
- 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`
+ 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `unencrypted_size`, `etag`
FROM `*PREFIX*filecache` WHERE parent = ? ORDER BY `name` ASC');
$result = $query->execute(array($fileId));
$files = $result->fetchAll();
@@ -234,7 +235,7 @@ class Cache {
* @return array
*/
function buildParts(array $data) {
- $fields = array('path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'encrypted', 'etag');
+ $fields = array('path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'encrypted', 'unencrypted_size', 'etag');
$params = array();
$queryParts = array();
foreach ($data as $name => $value) {
@@ -391,7 +392,7 @@ class Cache {
*/
public function search($pattern) {
$query = \OC_DB::prepare('
- SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`
+ SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `unencrypted_size`, `etag`
FROM `*PREFIX*filecache` WHERE `name` LIKE ? AND `storage` = ?'
);
$result = $query->execute(array($pattern, $this->numericId));
@@ -417,7 +418,7 @@ class Cache {
$where = '`mimepart` = ?';
}
$query = \OC_DB::prepare('
- SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`
+ SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `unencrypted_size`, `etag`
FROM `*PREFIX*filecache` WHERE ' . $where . ' AND `storage` = ?'
);
$mimetype = $this->getMimetypeId($mimetype);