summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/files/cache/cache.php29
-rw-r--r--lib/private/files/cache/homecache.php14
-rw-r--r--lib/private/files/fileinfo.php7
-rw-r--r--lib/private/files/storage/wrapper/encryption.php18
-rw-r--r--lib/private/files/storage/wrapper/quota.php5
-rw-r--r--lib/private/files/stream/encryption.php3
-rw-r--r--lib/private/share/share.php2
7 files changed, 17 insertions, 61 deletions
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 9a785d071f7..c5e118946e5 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -152,7 +152,7 @@ class Cache {
$params = array($file);
}
$sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
- `storage_mtime`, `encrypted`, `unencrypted_size`, `etag`, `permissions`
+ `storage_mtime`, `encrypted`, `etag`, `permissions`
FROM `*PREFIX*filecache` ' . $where;
$result = \OC_DB::executeAudited($sql, $params);
$data = $result->fetchRow();
@@ -175,7 +175,6 @@ class Cache {
$data['mtime'] = (int)$data['mtime'];
$data['storage_mtime'] = (int)$data['storage_mtime'];
$data['encrypted'] = (bool)$data['encrypted'];
- $data['unencrypted_size'] = 0 + $data['unencrypted_size'];
$data['storage'] = $this->storageId;
$data['mimetype'] = $this->getMimetype($data['mimetype']);
$data['mimepart'] = $this->getMimetype($data['mimepart']);
@@ -208,7 +207,7 @@ class Cache {
public function getFolderContentsById($fileId) {
if ($fileId > -1) {
$sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
- `storage_mtime`, `encrypted`, `unencrypted_size`, `etag`, `permissions`
+ `storage_mtime`, `encrypted`, `etag`, `permissions`
FROM `*PREFIX*filecache` WHERE `parent` = ? ORDER BY `name` ASC';
$result = \OC_DB::executeAudited($sql, array($fileId));
$files = $result->fetchAll();
@@ -218,10 +217,6 @@ class Cache {
if ($file['storage_mtime'] == 0) {
$file['storage_mtime'] = $file['mtime'];
}
- if ($file['encrypted'] or ($file['unencrypted_size'] > 0 and $file['mimetype'] === 'httpd/unix-directory')) {
- $file['encrypted_size'] = $file['size'];
- $file['size'] = $file['unencrypted_size'];
- }
$file['permissions'] = (int)$file['permissions'];
$file['mtime'] = (int)$file['mtime'];
$file['storage_mtime'] = (int)$file['storage_mtime'];
@@ -325,7 +320,7 @@ class Cache {
*/
function buildParts(array $data) {
$fields = array(
- 'path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'storage_mtime', 'encrypted', 'unencrypted_size',
+ 'path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'storage_mtime', 'encrypted',
'etag', 'permissions');
$params = array();
$queryParts = array();
@@ -521,7 +516,7 @@ class Cache {
$sql = '
SELECT `fileid`, `storage`, `path`, `parent`, `name`,
`mimetype`, `mimepart`, `size`, `mtime`, `encrypted`,
- `unencrypted_size`, `etag`, `permissions`
+ `etag`, `permissions`
FROM `*PREFIX*filecache`
WHERE `storage` = ? AND `name` ILIKE ?';
$result = \OC_DB::executeAudited($sql,
@@ -549,7 +544,7 @@ class Cache {
} else {
$where = '`mimepart` = ?';
}
- $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `unencrypted_size`, `etag`, `permissions`
+ $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `etag`, `permissions`
FROM `*PREFIX*filecache` WHERE ' . $where . ' AND `storage` = ?';
$mimetype = $this->getMimetypeId($mimetype);
$result = \OC_DB::executeAudited($sql, array($mimetype, $this->getNumericStorageId()));
@@ -574,7 +569,7 @@ class Cache {
public function searchByTag($tag, $userId) {
$sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, ' .
'`mimetype`, `mimepart`, `size`, `mtime`, ' .
- '`encrypted`, `unencrypted_size`, `etag`, `permissions` ' .
+ '`encrypted`, `etag`, `permissions` ' .
'FROM `*PREFIX*filecache` `file`, ' .
'`*PREFIX*vcategory_to_object` `tagmap`, ' .
'`*PREFIX*vcategory` `tag` ' .
@@ -638,17 +633,15 @@ class Cache {
}
if (isset($entry['mimetype']) && $entry['mimetype'] === 'httpd/unix-directory') {
$id = $entry['fileid'];
- $sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2, ' .
- 'SUM(`unencrypted_size`) AS f3 ' .
+ $sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2 ' .
'FROM `*PREFIX*filecache` ' .
'WHERE `parent` = ? AND `storage` = ?';
$result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId()));
if ($row = $result->fetchRow()) {
$result->closeCursor();
- list($sum, $min, $unencryptedSum) = array_values($row);
+ list($sum, $min) = array_values($row);
$sum = 0 + $sum;
$min = 0 + $min;
- $unencryptedSum = 0 + $unencryptedSum;
if ($min === -1) {
$totalSize = $min;
} else {
@@ -658,15 +651,9 @@ class Cache {
if ($entry['size'] !== $totalSize) {
$update['size'] = $totalSize;
}
- if (!isset($entry['unencrypted_size']) or $entry['unencrypted_size'] !== $unencryptedSum) {
- $update['unencrypted_size'] = $unencryptedSum;
- }
if (count($update) > 0) {
$this->update($id, $update);
}
- if ($totalSize !== -1 and $unencryptedSum > 0) {
- $totalSize = $unencryptedSum;
- }
} else {
$result->closeCursor();
}
diff --git a/lib/private/files/cache/homecache.php b/lib/private/files/cache/homecache.php
index aa075d41221..1b85462d615 100644
--- a/lib/private/files/cache/homecache.php
+++ b/lib/private/files/cache/homecache.php
@@ -48,26 +48,18 @@ class HomeCache extends Cache {
}
if ($entry && $entry['mimetype'] === 'httpd/unix-directory') {
$id = $entry['fileid'];
- $sql = 'SELECT SUM(`size`) AS f1, ' .
- 'SUM(`unencrypted_size`) AS f2 FROM `*PREFIX*filecache` ' .
+ $sql = 'SELECT SUM(`size`) AS f1 ' .
+ 'FROM `*PREFIX*filecache` ' .
'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0';
$result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId()));
if ($row = $result->fetchRow()) {
$result->closeCursor();
- list($sum, $unencryptedSum) = array_values($row);
+ list($sum) = array_values($row);
$totalSize = 0 + $sum;
- $unencryptedSize = 0 + $unencryptedSum;
$entry['size'] += 0;
- if (!isset($entry['unencrypted_size'])) {
- $entry['unencrypted_size'] = 0;
- }
- $entry['unencrypted_size'] += 0;
if ($entry['size'] !== $totalSize) {
$this->update($id, array('size' => $totalSize));
}
- if ($entry['unencrypted_size'] !== $unencryptedSize) {
- $this->update($id, array('unencrypted_size' => $unencryptedSize));
- }
}
}
return $totalSize;
diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php
index 03aad56e103..82c8f3de690 100644
--- a/lib/private/files/fileinfo.php
+++ b/lib/private/files/fileinfo.php
@@ -170,13 +170,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
/**
* @return int
*/
- public function getUnencryptedSize() {
- return isset($this->data['unencrypted_size']) ? $this->data['unencrypted_size'] : 0;
- }
-
- /**
- * @return int
- */
public function getPermissions() {
return $this->data['permissions'];
}
diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php
index a9e65a00147..8892194f32b 100644
--- a/lib/private/files/storage/wrapper/encryption.php
+++ b/lib/private/files/storage/wrapper/encryption.php
@@ -77,27 +77,15 @@ class Encryption extends Wrapper {
* @return int
*/
public function filesize($path) {
- $size = 0;
$fullPath = $this->getFullPath($path);
-
- $encryptedSize = $this->storage->filesize($path);
+ $size = $this->storage->filesize($path);
$info = $this->getCache()->get($path);
- if($encryptedSize > 0 && $info['encrypted']) {
- $size = $info['unencrypted_size'];
- if ($size <= 0) {
- $encryptionModule = $this->getEncryptionModule($path);
- if ($encryptionModule) {
- $size = $encryptionModule->calculateUnencryptedSize($fullPath);
- $this->getCache()->update($info['fileid'], array('unencrypted_size' => $size));
- }
- }
- } else if (isset($this->unencryptedSize[$fullPath]) && isset($info['fileid'])) {
+ if (isset($this->unencryptedSize[$fullPath]) && isset($info['fileid'])) {
$size = $this->unencryptedSize[$fullPath];
$info['encrypted'] = true;
- $info['unencrypted_size'] = $size;
- $info['size'] = $encryptedSize;
+ $info['size'] = $size;
$this->getCache()->put($path, $info);
}
diff --git a/lib/private/files/storage/wrapper/quota.php b/lib/private/files/storage/wrapper/quota.php
index 34bd2589947..3c0fda98dad 100644
--- a/lib/private/files/storage/wrapper/quota.php
+++ b/lib/private/files/storage/wrapper/quota.php
@@ -60,11 +60,6 @@ class Quota extends Wrapper {
$cache = $this->getCache();
$data = $cache->get($path);
if (is_array($data) and isset($data['size'])) {
- if (isset($data['unencrypted_size'])
- && $data['unencrypted_size'] > 0
- ) {
- return $data['unencrypted_size'];
- }
return $data['size'];
} else {
return \OCP\Files\FileInfo::SPACE_NOT_COMPUTED;
diff --git a/lib/private/files/stream/encryption.php b/lib/private/files/stream/encryption.php
index df74eeff893..e3927edff2c 100644
--- a/lib/private/files/stream/encryption.php
+++ b/lib/private/files/stream/encryption.php
@@ -271,7 +271,8 @@ class Encryption extends Wrapper {
public function stream_write($data) {
if ($this->position === 0) {
- $this->size+=$this->writeHeader();
+ $this->writeHeader();
+ $this->size+=$this->util->getHeaderSize();
}
$length = 0;
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 90f3f28f2ee..98c612d5eb6 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -2214,7 +2214,7 @@ class Share extends \OC\Share\Constants {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`, `uid_owner`, '
. '`share_type`, `share_with`, `file_source`, `path`, `file_target`, `stime`, '
. '`*PREFIX*share`.`permissions`, `expiration`, `storage`, `*PREFIX*filecache`.`parent` as `file_parent`, '
- . '`name`, `mtime`, `mimetype`, `mimepart`, `size`, `unencrypted_size`, `encrypted`, `etag`, `mail_send`';
+ . '`name`, `mtime`, `mimetype`, `mimepart`, `size`, `encrypted`, `etag`, `mail_send`';
} else {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`,'
. '`*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`,'