diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-05-11 12:46:16 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-05-11 12:46:16 +0200 |
commit | a90581b405d1aff8bbe3abbfeb9970798a9cce6e (patch) | |
tree | 31e9e9c86b3d6a0e2c6d888f5af7f50f7d336dec /lib/private/Files/Cache/Cache.php | |
parent | 979f4033ca1cd0be7f255f028d4cc637a216440d (diff) | |
download | nextcloud-server-a90581b405d1aff8bbe3abbfeb9970798a9cce6e.tar.gz nextcloud-server-a90581b405d1aff8bbe3abbfeb9970798a9cce6e.zip |
Get rid of more int casts in file size manipulations
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/Files/Cache/Cache.php')
-rw-r--r-- | lib/private/Files/Cache/Cache.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 933fee5630f..5632f9db03e 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -60,6 +60,7 @@ use OCP\Files\Search\ISearchOperator; use OCP\Files\Search\ISearchQuery; use OCP\Files\Storage\IStorage; use OCP\IDBConnection; +use OCP\Util; use Psr\Log\LoggerInterface; /** @@ -191,8 +192,8 @@ class Cache implements ICache { $data['path'] = (string)$data['path']; $data['fileid'] = (int)$data['fileid']; $data['parent'] = (int)$data['parent']; - $data['size'] = 0 + $data['size']; - $data['unencrypted_size'] = 0 + ($data['unencrypted_size'] ?? 0); + $data['size'] = Util::numericToNumber($data['size']); + $data['unencrypted_size'] = Util::numericToNumber($data['unencrypted_size'] ?? 0); $data['mtime'] = (int)$data['mtime']; $data['storage_mtime'] = (int)$data['storage_mtime']; $data['encryptedVersion'] = (int)$data['encrypted']; @@ -913,7 +914,7 @@ class Cache implements ICache { * @param string $path * @param array|null|ICacheEntry $entry (optional) meta data of the folder * @param bool $ignoreUnknown don't mark the folder size as unknown if any of it's children are unknown - * @return int + * @return int|float */ protected function calculateFolderSizeInner(string $path, $entry = null, bool $ignoreUnknown = false) { $totalSize = 0; @@ -937,13 +938,13 @@ class Cache implements ICache { if ($rows) { $sizes = array_map(function (array $row) { - return (int)$row['size']; + return Util::numericToNumber($row['size']); }, $rows); $unencryptedOnlySizes = array_map(function (array $row) { - return (int)$row['unencrypted_size']; + return Util::numericToNumber($row['unencrypted_size']); }, $rows); $unencryptedSizes = array_map(function (array $row) { - return (int)(($row['unencrypted_size'] > 0) ? $row['unencrypted_size'] : $row['size']); + return Util::numericToNumber(($row['unencrypted_size'] > 0) ? $row['unencrypted_size'] : $row['size']); }, $rows); $sum = array_sum($sizes); |