remove unencrypted_size from the cache, size will contain the unencrypted size
This commit is contained in:
parent
d185761d31
commit
0eee3a2618
|
@ -122,7 +122,7 @@ class Shared_Cache extends Cache {
|
||||||
}
|
}
|
||||||
$query = \OC_DB::prepare(
|
$query = \OC_DB::prepare(
|
||||||
'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`,'
|
'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`,'
|
||||||
. ' `size`, `mtime`, `encrypted`, `unencrypted_size`, `storage_mtime`, `etag`, `permissions`'
|
. ' `size`, `mtime`, `encrypted`, `storage_mtime`, `etag`, `permissions`'
|
||||||
. ' FROM `*PREFIX*filecache` WHERE `fileid` = ?');
|
. ' FROM `*PREFIX*filecache` WHERE `fileid` = ?');
|
||||||
$result = $query->execute(array($sourceId));
|
$result = $query->execute(array($sourceId));
|
||||||
$data = $result->fetchRow();
|
$data = $result->fetchRow();
|
||||||
|
@ -135,12 +135,7 @@ class Shared_Cache extends Cache {
|
||||||
if ($data['storage_mtime'] === 0) {
|
if ($data['storage_mtime'] === 0) {
|
||||||
$data['storage_mtime'] = $data['mtime'];
|
$data['storage_mtime'] = $data['mtime'];
|
||||||
}
|
}
|
||||||
if ($data['encrypted'] or ($data['unencrypted_size'] > 0 and $data['mimetype'] === 'httpd/unix-directory')) {
|
|
||||||
$data['encrypted_size'] = (int)$data['size'];
|
|
||||||
$data['size'] = (int)$data['unencrypted_size'];
|
|
||||||
} else {
|
|
||||||
$data['size'] = (int)$data['size'];
|
$data['size'] = (int)$data['size'];
|
||||||
}
|
|
||||||
$data['permissions'] = (int)$data['permissions'];
|
$data['permissions'] = (int)$data['permissions'];
|
||||||
if (!is_int($file) || $file === 0) {
|
if (!is_int($file) || $file === 0) {
|
||||||
$data['path'] = '';
|
$data['path'] = '';
|
||||||
|
|
|
@ -128,12 +128,7 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
|
||||||
|
|
||||||
$storage = \OC\Files\Filesystem::getStorage('/');
|
$storage = \OC\Files\Filesystem::getStorage('/');
|
||||||
$cache = $storage->getCache();
|
$cache = $storage->getCache();
|
||||||
if ($item['encrypted'] or ($item['unencrypted_size'] > 0 and $cache->getMimetype($item['mimetype']) === 'httpd/unix-directory')) {
|
|
||||||
$file['size'] = $item['unencrypted_size'];
|
|
||||||
$file['encrypted_size'] = $item['size'];
|
|
||||||
} else {
|
|
||||||
$file['size'] = $item['size'];
|
$file['size'] = $item['size'];
|
||||||
}
|
|
||||||
$files[] = $file;
|
$files[] = $file;
|
||||||
}
|
}
|
||||||
return $files;
|
return $files;
|
||||||
|
|
|
@ -152,7 +152,7 @@ class Cache {
|
||||||
$params = array($file);
|
$params = array($file);
|
||||||
}
|
}
|
||||||
$sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
|
$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;
|
FROM `*PREFIX*filecache` ' . $where;
|
||||||
$result = \OC_DB::executeAudited($sql, $params);
|
$result = \OC_DB::executeAudited($sql, $params);
|
||||||
$data = $result->fetchRow();
|
$data = $result->fetchRow();
|
||||||
|
@ -175,7 +175,6 @@ class Cache {
|
||||||
$data['mtime'] = (int)$data['mtime'];
|
$data['mtime'] = (int)$data['mtime'];
|
||||||
$data['storage_mtime'] = (int)$data['storage_mtime'];
|
$data['storage_mtime'] = (int)$data['storage_mtime'];
|
||||||
$data['encrypted'] = (bool)$data['encrypted'];
|
$data['encrypted'] = (bool)$data['encrypted'];
|
||||||
$data['unencrypted_size'] = 0 + $data['unencrypted_size'];
|
|
||||||
$data['storage'] = $this->storageId;
|
$data['storage'] = $this->storageId;
|
||||||
$data['mimetype'] = $this->getMimetype($data['mimetype']);
|
$data['mimetype'] = $this->getMimetype($data['mimetype']);
|
||||||
$data['mimepart'] = $this->getMimetype($data['mimepart']);
|
$data['mimepart'] = $this->getMimetype($data['mimepart']);
|
||||||
|
@ -208,7 +207,7 @@ class Cache {
|
||||||
public function getFolderContentsById($fileId) {
|
public function getFolderContentsById($fileId) {
|
||||||
if ($fileId > -1) {
|
if ($fileId > -1) {
|
||||||
$sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
|
$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';
|
FROM `*PREFIX*filecache` WHERE `parent` = ? ORDER BY `name` ASC';
|
||||||
$result = \OC_DB::executeAudited($sql, array($fileId));
|
$result = \OC_DB::executeAudited($sql, array($fileId));
|
||||||
$files = $result->fetchAll();
|
$files = $result->fetchAll();
|
||||||
|
@ -218,10 +217,6 @@ class Cache {
|
||||||
if ($file['storage_mtime'] == 0) {
|
if ($file['storage_mtime'] == 0) {
|
||||||
$file['storage_mtime'] = $file['mtime'];
|
$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['permissions'] = (int)$file['permissions'];
|
||||||
$file['mtime'] = (int)$file['mtime'];
|
$file['mtime'] = (int)$file['mtime'];
|
||||||
$file['storage_mtime'] = (int)$file['storage_mtime'];
|
$file['storage_mtime'] = (int)$file['storage_mtime'];
|
||||||
|
@ -325,7 +320,7 @@ class Cache {
|
||||||
*/
|
*/
|
||||||
function buildParts(array $data) {
|
function buildParts(array $data) {
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'storage_mtime', 'encrypted', 'unencrypted_size',
|
'path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'storage_mtime', 'encrypted',
|
||||||
'etag', 'permissions');
|
'etag', 'permissions');
|
||||||
$params = array();
|
$params = array();
|
||||||
$queryParts = array();
|
$queryParts = array();
|
||||||
|
@ -521,7 +516,7 @@ class Cache {
|
||||||
$sql = '
|
$sql = '
|
||||||
SELECT `fileid`, `storage`, `path`, `parent`, `name`,
|
SELECT `fileid`, `storage`, `path`, `parent`, `name`,
|
||||||
`mimetype`, `mimepart`, `size`, `mtime`, `encrypted`,
|
`mimetype`, `mimepart`, `size`, `mtime`, `encrypted`,
|
||||||
`unencrypted_size`, `etag`, `permissions`
|
`etag`, `permissions`
|
||||||
FROM `*PREFIX*filecache`
|
FROM `*PREFIX*filecache`
|
||||||
WHERE `storage` = ? AND `name` ILIKE ?';
|
WHERE `storage` = ? AND `name` ILIKE ?';
|
||||||
$result = \OC_DB::executeAudited($sql,
|
$result = \OC_DB::executeAudited($sql,
|
||||||
|
@ -549,7 +544,7 @@ class Cache {
|
||||||
} else {
|
} else {
|
||||||
$where = '`mimepart` = ?';
|
$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` = ?';
|
FROM `*PREFIX*filecache` WHERE ' . $where . ' AND `storage` = ?';
|
||||||
$mimetype = $this->getMimetypeId($mimetype);
|
$mimetype = $this->getMimetypeId($mimetype);
|
||||||
$result = \OC_DB::executeAudited($sql, array($mimetype, $this->getNumericStorageId()));
|
$result = \OC_DB::executeAudited($sql, array($mimetype, $this->getNumericStorageId()));
|
||||||
|
@ -574,7 +569,7 @@ class Cache {
|
||||||
public function searchByTag($tag, $userId) {
|
public function searchByTag($tag, $userId) {
|
||||||
$sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, ' .
|
$sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, ' .
|
||||||
'`mimetype`, `mimepart`, `size`, `mtime`, ' .
|
'`mimetype`, `mimepart`, `size`, `mtime`, ' .
|
||||||
'`encrypted`, `unencrypted_size`, `etag`, `permissions` ' .
|
'`encrypted`, `etag`, `permissions` ' .
|
||||||
'FROM `*PREFIX*filecache` `file`, ' .
|
'FROM `*PREFIX*filecache` `file`, ' .
|
||||||
'`*PREFIX*vcategory_to_object` `tagmap`, ' .
|
'`*PREFIX*vcategory_to_object` `tagmap`, ' .
|
||||||
'`*PREFIX*vcategory` `tag` ' .
|
'`*PREFIX*vcategory` `tag` ' .
|
||||||
|
@ -638,17 +633,15 @@ class Cache {
|
||||||
}
|
}
|
||||||
if (isset($entry['mimetype']) && $entry['mimetype'] === 'httpd/unix-directory') {
|
if (isset($entry['mimetype']) && $entry['mimetype'] === 'httpd/unix-directory') {
|
||||||
$id = $entry['fileid'];
|
$id = $entry['fileid'];
|
||||||
$sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2, ' .
|
$sql = 'SELECT SUM(`size`) AS f1, MIN(`size`) AS f2 ' .
|
||||||
'SUM(`unencrypted_size`) AS f3 ' .
|
|
||||||
'FROM `*PREFIX*filecache` ' .
|
'FROM `*PREFIX*filecache` ' .
|
||||||
'WHERE `parent` = ? AND `storage` = ?';
|
'WHERE `parent` = ? AND `storage` = ?';
|
||||||
$result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId()));
|
$result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId()));
|
||||||
if ($row = $result->fetchRow()) {
|
if ($row = $result->fetchRow()) {
|
||||||
$result->closeCursor();
|
$result->closeCursor();
|
||||||
list($sum, $min, $unencryptedSum) = array_values($row);
|
list($sum, $min) = array_values($row);
|
||||||
$sum = 0 + $sum;
|
$sum = 0 + $sum;
|
||||||
$min = 0 + $min;
|
$min = 0 + $min;
|
||||||
$unencryptedSum = 0 + $unencryptedSum;
|
|
||||||
if ($min === -1) {
|
if ($min === -1) {
|
||||||
$totalSize = $min;
|
$totalSize = $min;
|
||||||
} else {
|
} else {
|
||||||
|
@ -658,15 +651,9 @@ class Cache {
|
||||||
if ($entry['size'] !== $totalSize) {
|
if ($entry['size'] !== $totalSize) {
|
||||||
$update['size'] = $totalSize;
|
$update['size'] = $totalSize;
|
||||||
}
|
}
|
||||||
if (!isset($entry['unencrypted_size']) or $entry['unencrypted_size'] !== $unencryptedSum) {
|
|
||||||
$update['unencrypted_size'] = $unencryptedSum;
|
|
||||||
}
|
|
||||||
if (count($update) > 0) {
|
if (count($update) > 0) {
|
||||||
$this->update($id, $update);
|
$this->update($id, $update);
|
||||||
}
|
}
|
||||||
if ($totalSize !== -1 and $unencryptedSum > 0) {
|
|
||||||
$totalSize = $unencryptedSum;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$result->closeCursor();
|
$result->closeCursor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,26 +48,18 @@ class HomeCache extends Cache {
|
||||||
}
|
}
|
||||||
if ($entry && $entry['mimetype'] === 'httpd/unix-directory') {
|
if ($entry && $entry['mimetype'] === 'httpd/unix-directory') {
|
||||||
$id = $entry['fileid'];
|
$id = $entry['fileid'];
|
||||||
$sql = 'SELECT SUM(`size`) AS f1, ' .
|
$sql = 'SELECT SUM(`size`) AS f1 ' .
|
||||||
'SUM(`unencrypted_size`) AS f2 FROM `*PREFIX*filecache` ' .
|
'FROM `*PREFIX*filecache` ' .
|
||||||
'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0';
|
'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0';
|
||||||
$result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId()));
|
$result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId()));
|
||||||
if ($row = $result->fetchRow()) {
|
if ($row = $result->fetchRow()) {
|
||||||
$result->closeCursor();
|
$result->closeCursor();
|
||||||
list($sum, $unencryptedSum) = array_values($row);
|
list($sum) = array_values($row);
|
||||||
$totalSize = 0 + $sum;
|
$totalSize = 0 + $sum;
|
||||||
$unencryptedSize = 0 + $unencryptedSum;
|
|
||||||
$entry['size'] += 0;
|
$entry['size'] += 0;
|
||||||
if (!isset($entry['unencrypted_size'])) {
|
|
||||||
$entry['unencrypted_size'] = 0;
|
|
||||||
}
|
|
||||||
$entry['unencrypted_size'] += 0;
|
|
||||||
if ($entry['size'] !== $totalSize) {
|
if ($entry['size'] !== $totalSize) {
|
||||||
$this->update($id, array('size' => $totalSize));
|
$this->update($id, array('size' => $totalSize));
|
||||||
}
|
}
|
||||||
if ($entry['unencrypted_size'] !== $unencryptedSize) {
|
|
||||||
$this->update($id, array('unencrypted_size' => $unencryptedSize));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $totalSize;
|
return $totalSize;
|
||||||
|
|
|
@ -167,13 +167,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
|
||||||
return $this->data['encrypted'];
|
return $this->data['encrypted'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getUnencryptedSize() {
|
|
||||||
return isset($this->data['unencrypted_size']) ? $this->data['unencrypted_size'] : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -77,27 +77,15 @@ class Encryption extends Wrapper {
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function filesize($path) {
|
public function filesize($path) {
|
||||||
$size = 0;
|
|
||||||
$fullPath = $this->getFullPath($path);
|
$fullPath = $this->getFullPath($path);
|
||||||
|
$size = $this->storage->filesize($path);
|
||||||
$encryptedSize = $this->storage->filesize($path);
|
|
||||||
|
|
||||||
$info = $this->getCache()->get($path);
|
$info = $this->getCache()->get($path);
|
||||||
|
|
||||||
if($encryptedSize > 0 && $info['encrypted']) {
|
if (isset($this->unencryptedSize[$fullPath]) && isset($info['fileid'])) {
|
||||||
$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'])) {
|
|
||||||
$size = $this->unencryptedSize[$fullPath];
|
$size = $this->unencryptedSize[$fullPath];
|
||||||
$info['encrypted'] = true;
|
$info['encrypted'] = true;
|
||||||
$info['unencrypted_size'] = $size;
|
$info['size'] = $size;
|
||||||
$info['size'] = $encryptedSize;
|
|
||||||
$this->getCache()->put($path, $info);
|
$this->getCache()->put($path, $info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,11 +60,6 @@ class Quota extends Wrapper {
|
||||||
$cache = $this->getCache();
|
$cache = $this->getCache();
|
||||||
$data = $cache->get($path);
|
$data = $cache->get($path);
|
||||||
if (is_array($data) and isset($data['size'])) {
|
if (is_array($data) and isset($data['size'])) {
|
||||||
if (isset($data['unencrypted_size'])
|
|
||||||
&& $data['unencrypted_size'] > 0
|
|
||||||
) {
|
|
||||||
return $data['unencrypted_size'];
|
|
||||||
}
|
|
||||||
return $data['size'];
|
return $data['size'];
|
||||||
} else {
|
} else {
|
||||||
return \OCP\Files\FileInfo::SPACE_NOT_COMPUTED;
|
return \OCP\Files\FileInfo::SPACE_NOT_COMPUTED;
|
||||||
|
|
|
@ -271,7 +271,8 @@ class Encryption extends Wrapper {
|
||||||
public function stream_write($data) {
|
public function stream_write($data) {
|
||||||
|
|
||||||
if ($this->position === 0) {
|
if ($this->position === 0) {
|
||||||
$this->size+=$this->writeHeader();
|
$this->writeHeader();
|
||||||
|
$this->size+=$this->util->getHeaderSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
$length = 0;
|
$length = 0;
|
||||||
|
|
|
@ -2214,7 +2214,7 @@ class Share extends \OC\Share\Constants {
|
||||||
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`, `uid_owner`, '
|
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`, `uid_owner`, '
|
||||||
. '`share_type`, `share_with`, `file_source`, `path`, `file_target`, `stime`, '
|
. '`share_type`, `share_with`, `file_source`, `path`, `file_target`, `stime`, '
|
||||||
. '`*PREFIX*share`.`permissions`, `expiration`, `storage`, `*PREFIX*filecache`.`parent` as `file_parent`, '
|
. '`*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 {
|
} else {
|
||||||
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`,'
|
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`,'
|
||||||
. '`*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`,'
|
. '`*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`,'
|
||||||
|
|
|
@ -183,8 +183,8 @@ class Cache extends \Test\TestCase {
|
||||||
$file3 = 'folder/foo';
|
$file3 = 'folder/foo';
|
||||||
$data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory');
|
$data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory');
|
||||||
$fileData = array();
|
$fileData = array();
|
||||||
$fileData['bar'] = array('size' => 1000, 'unencrypted_size' => 900, 'encrypted' => 1, 'mtime' => 20, 'mimetype' => 'foo/file');
|
$fileData['bar'] = array('size' => 1000, 'encrypted' => 1, 'mtime' => 20, 'mimetype' => 'foo/file');
|
||||||
$fileData['foo'] = array('size' => 20, 'unencrypted_size' => 16, 'encrypted' => 1, 'mtime' => 25, 'mimetype' => 'foo/file');
|
$fileData['foo'] = array('size' => 20, 'encrypted' => 1, 'mtime' => 25, 'mimetype' => 'foo/file');
|
||||||
|
|
||||||
$this->cache->put($file1, $data1);
|
$this->cache->put($file1, $data1);
|
||||||
$this->cache->put($file2, $fileData['bar']);
|
$this->cache->put($file2, $fileData['bar']);
|
||||||
|
@ -194,8 +194,6 @@ class Cache extends \Test\TestCase {
|
||||||
$this->assertEquals(count($content), 2);
|
$this->assertEquals(count($content), 2);
|
||||||
foreach ($content as $cachedData) {
|
foreach ($content as $cachedData) {
|
||||||
$data = $fileData[$cachedData['name']];
|
$data = $fileData[$cachedData['name']];
|
||||||
// indirect retrieval swaps unencrypted_size and size
|
|
||||||
$this->assertEquals($data['unencrypted_size'], $cachedData['size']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$file4 = 'folder/unkownSize';
|
$file4 = 'folder/unkownSize';
|
||||||
|
@ -211,7 +209,6 @@ class Cache extends \Test\TestCase {
|
||||||
// direct cache entry retrieval returns the original values
|
// direct cache entry retrieval returns the original values
|
||||||
$entry = $this->cache->get($file1);
|
$entry = $this->cache->get($file1);
|
||||||
$this->assertEquals(1025, $entry['size']);
|
$this->assertEquals(1025, $entry['size']);
|
||||||
$this->assertEquals(916, $entry['unencrypted_size']);
|
|
||||||
|
|
||||||
$this->cache->remove($file2);
|
$this->cache->remove($file2);
|
||||||
$this->cache->remove($file3);
|
$this->cache->remove($file3);
|
||||||
|
|
|
@ -59,7 +59,7 @@ class Quota extends \Test\Files\Storage\Storage {
|
||||||
public function testFreeSpaceWithUsedSpace() {
|
public function testFreeSpaceWithUsedSpace() {
|
||||||
$instance = $this->getLimitedStorage(9);
|
$instance = $this->getLimitedStorage(9);
|
||||||
$instance->getCache()->put(
|
$instance->getCache()->put(
|
||||||
'', array('size' => 3, 'unencrypted_size' => 0)
|
'', array('size' => 3)
|
||||||
);
|
);
|
||||||
$this->assertEquals(6, $instance->free_space(''));
|
$this->assertEquals(6, $instance->free_space(''));
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ class Quota extends \Test\Files\Storage\Storage {
|
||||||
|
|
||||||
$instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 9));
|
$instance = new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => 9));
|
||||||
$instance->getCache()->put(
|
$instance->getCache()->put(
|
||||||
'', array('size' => 3, 'unencrypted_size' => 0)
|
'', array('size' => 3)
|
||||||
);
|
);
|
||||||
$this->assertEquals(6, $instance->free_space(''));
|
$this->assertEquals(6, $instance->free_space(''));
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ class Quota extends \Test\Files\Storage\Storage {
|
||||||
public function testFreeSpaceWithUsedSpaceAndEncryption() {
|
public function testFreeSpaceWithUsedSpaceAndEncryption() {
|
||||||
$instance = $this->getLimitedStorage(9);
|
$instance = $this->getLimitedStorage(9);
|
||||||
$instance->getCache()->put(
|
$instance->getCache()->put(
|
||||||
'', array('size' => 7, 'unencrypted_size' => 3)
|
'', array('size' => 7)
|
||||||
);
|
);
|
||||||
$this->assertEquals(6, $instance->free_space(''));
|
$this->assertEquals(6, $instance->free_space(''));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue