Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
use OCP\Files\Search\ISearchQuery;
use OCP\Files\Storage\IStorage;
use OCP\IDBConnection;
use OCP\Util;
use Psr\Log\LoggerInterface;

/**
Expand Down Expand Up @@ -189,8 +190,8 @@ public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader
//fix types
$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']);

Check failure

Code scanning / Psalm

UndefinedMethod

Method OCP\Util::numerictonumber does not exist
$data['unencrypted_size'] = Util::numericToNumber($data['unencrypted_size'] ?? 0);

Check failure

Code scanning / Psalm

UndefinedMethod

Method OCP\Util::numerictonumber does not exist
$data['mtime'] = (int)$data['mtime'];
$data['storage_mtime'] = (int)$data['storage_mtime'];
$data['encryptedVersion'] = (int)$data['encrypted'];
Expand Down Expand Up @@ -901,13 +902,13 @@ public function calculateFolderSize($path, $entry = null) {

if ($rows) {
$sizes = array_map(function (array $row) {
return (int)$row['size'];
return Util::numericToNumber($row['size']);

Check failure

Code scanning / Psalm

UndefinedMethod

Method OCP\Util::numerictonumber does not exist
}, $rows);
$unencryptedOnlySizes = array_map(function (array $row) {
return (int)$row['unencrypted_size'];
return Util::numericToNumber($row['unencrypted_size']);

Check failure

Code scanning / Psalm

UndefinedMethod

Method OCP\Util::numerictonumber does not exist
}, $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']);

Check failure

Code scanning / Psalm

UndefinedMethod

Method OCP\Util::numerictonumber does not exist
}, $rows);

$sum = array_sum($sizes);
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ protected function getExistingChildren($folderId) {
* @param int $folderId id for the folder to be scanned
* @param bool $lock set to false to disable getting an additional read lock during scanning
* @param array $data the data of the folder before (re)scanning the children
* @return int the size of the scanned folder or -1 if the size is unknown at this stage
* @return int|float the size of the scanned folder or -1 if the size is unknown at this stage
*/
protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $folderId = null, $lock = true, array $data = []) {
if ($reuse === -1) {
Expand Down
5 changes: 3 additions & 2 deletions lib/private/Files/Storage/DAV.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
use OCP\Files\StorageNotAvailableException;
use OCP\Http\Client\IClientService;
use OCP\ICertificateManager;
use OCP\Util;
use Psr\Http\Message\ResponseInterface;
use Sabre\DAV\Client;
use Sabre\DAV\Xml\Property\ResourceType;
Expand Down Expand Up @@ -433,7 +434,7 @@ public function free_space($path) {
return FileInfo::SPACE_UNKNOWN;
}
if (isset($response['{DAV:}quota-available-bytes'])) {
return (int)$response['{DAV:}quota-available-bytes'];
return Util::numericToNumber($response['{DAV:}quota-available-bytes']);

Check failure

Code scanning / Psalm

UndefinedMethod

Method OCP\Util::numerictonumber does not exist
} else {
return FileInfo::SPACE_UNKNOWN;
}
Expand Down Expand Up @@ -587,7 +588,7 @@ public function stat($path) {
}
return [
'mtime' => isset($response['{DAV:}getlastmodified']) ? strtotime($response['{DAV:}getlastmodified']) : null,
'size' => (int)($response['{DAV:}getcontentlength'] ?? 0),
'size' => Util::numericToNumber($response['{DAV:}getcontentlength'] ?? 0),

Check failure

Code scanning / Psalm

UndefinedMethod

Method OCP\Util::numerictonumber does not exist
];
} catch (\Exception $e) {
$this->convertException($e, $path);
Expand Down
1 change: 1 addition & 0 deletions lib/private/Files/Storage/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
use OCP\Files\IMimeTypeDetector;
use OCP\Files\Storage\IStorage;
use OCP\IConfig;
use OCP\Util;
use Psr\Log\LoggerInterface;

/**
Expand Down