summaryrefslogtreecommitdiffstats
path: root/lib/files/cache/cache.php
diff options
context:
space:
mode:
authorFlorin Peter <github@florin-peter.de>2013-05-24 20:54:13 +0200
committerFlorin Peter <github@florin-peter.de>2013-05-24 20:54:13 +0200
commit946e9ccc0ade60bb9ff34ace9e94e85cce6af96c (patch)
tree4770fb73b25d6eb50caa2149df8fb06dd8928a45 /lib/files/cache/cache.php
parent5076c0d392f6eb17e368a9382cf5b0abe7408889 (diff)
parentae9adcaf8cc1f2b279494cfdd30a1d62d41f5060 (diff)
downloadnextcloud-server-946e9ccc0ade60bb9ff34ace9e94e85cce6af96c.tar.gz
nextcloud-server-946e9ccc0ade60bb9ff34ace9e94e85cce6af96c.zip
Merge branch 'master' into fix_for_2377
Diffstat (limited to 'lib/files/cache/cache.php')
-rw-r--r--lib/files/cache/cache.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index 865abd5286f..2c34fb77925 100644
--- a/lib/files/cache/cache.php
+++ b/lib/files/cache/cache.php
@@ -110,7 +110,7 @@ class Cache {
$params = array($file);
}
$query = \OC_DB::prepare(
- 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`
+ 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `unencrypted_size`, `etag`
FROM `*PREFIX*filecache` ' . $where);
$result = $query->execute($params);
$data = $result->fetchRow();
@@ -126,6 +126,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']);
@@ -147,8 +148,9 @@ class Cache {
$fileId = $this->getId($folder);
if ($fileId > -1) {
$query = \OC_DB::prepare(
- 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`
- FROM `*PREFIX*filecache` WHERE `parent` = ? ORDER BY `name` ASC');
+ 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `unencrypted_size`, `etag`
+ FROM `*PREFIX*filecache` WHERE `parent` = ? ORDER BY `name` ASC');
+
$result = $query->execute(array($fileId));
if (\OC_DB::isError($result)) {
\OCP\Util::writeLog('cache', 'getFolderContents failed: ' . $result->getMessage(), \OCP\Util::ERROR);
@@ -239,7 +241,7 @@ class Cache {
* @return array
*/
function buildParts(array $data) {
- $fields = array('path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'storage_mtime', 'encrypted', 'etag');
+ $fields = array('path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'storage_mtime', 'encrypted', 'unencrypted_size', 'etag');
$params = array();
$queryParts = array();
foreach ($data as $name => $value) {
@@ -410,7 +412,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->getNumericStorageId()));
@@ -436,7 +438,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);