summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db_structure.xml8
-rw-r--r--lib/files/cache/cache.php13
-rw-r--r--lib/files/cache/scanner.php2
-rw-r--r--lib/files/view.php3
4 files changed, 19 insertions, 7 deletions
diff --git a/db_structure.xml b/db_structure.xml
index 81bdb876493..3d9159eb019 100644
--- a/db_structure.xml
+++ b/db_structure.xml
@@ -286,6 +286,14 @@
</field>
<field>
+ <name>unencrypted_size</name>
+ <type>integer</type>
+ <default></default>
+ <notnull>true</notnull>
+ <length>8</length>
+ </field>
+
+ <field>
<name>etag</name>
<type>text</type>
<default></default>
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index d30c5cd16ed..1d73cb9c761 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) {
@@ -394,7 +395,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));
@@ -420,7 +421,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);
@@ -443,7 +444,7 @@ class Cache {
$this->calculateFolderSize($path);
if ($path !== '') {
$parent = dirname($path);
- if ($parent === '.') {
+ if ($parent === '.' or $parent === '/') {
$parent = '';
}
$this->correctFolderSize($parent);
diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php
index 594483e8be0..0b1947f17ca 100644
--- a/lib/files/cache/scanner.php
+++ b/lib/files/cache/scanner.php
@@ -70,7 +70,7 @@ class Scanner {
if ($data) {
if ($file) {
$parent = dirname($file);
- if ($parent === '.') {
+ if ($parent === '.' or $parent === '/') {
$parent = '';
}
if (!$this->cache->inCache($parent)) {
diff --git a/lib/files/view.php b/lib/files/view.php
index 8c3f6bf6a19..61088cd2ca0 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -755,6 +755,9 @@ class View {
$data['permissions'] = $permissions;
}
}
+
+ $data = \OC_FileProxy::runPostProxies('getFileInfo', $path, $data);
+
return $data;
}