Skip to content

Commit 87cbbb4

Browse files
authored
Merge pull request #35334 from nextcloud/revert-34032-backport/34019/stable24
Revert "[stable24] Fix quota type to int"
2 parents 7031a4b + f8e18e5 commit 87cbbb4

3 files changed

Lines changed: 23 additions & 6 deletions

File tree

build/psalm-baseline.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4404,7 +4404,8 @@
44044404
<InvalidReturnType occurrences="1">
44054405
<code>IImage|null</code>
44064406
</InvalidReturnType>
4407-
<InvalidScalarArgument occurrences="1">
4407+
<InvalidScalarArgument occurrences="2">
4408+
<code>$quota</code>
44084409
<code>$this-&gt;lastLogin</code>
44094410
</InvalidScalarArgument>
44104411
<NullableReturnStatement occurrences="1">
@@ -4528,6 +4529,14 @@
45284529
<code>\Test\Util\User\Dummy</code>
45294530
</UndefinedClass>
45304531
</file>
4532+
<file src="lib/private/legacy/OC_Util.php">
4533+
<InvalidReturnStatement occurrences="1">
4534+
<code>OC_Helper::computerFileSize($userQuota)</code>
4535+
</InvalidReturnStatement>
4536+
<InvalidReturnType occurrences="1">
4537+
<code>float</code>
4538+
</InvalidReturnType>
4539+
</file>
45314540
<file src="lib/public/AppFramework/ApiController.php">
45324541
<NoInterfaceProperties occurrences="1">
45334542
<code>$this-&gt;request-&gt;server</code>
@@ -4625,4 +4634,12 @@
46254634
<code>PreconditionNotMetException</code>
46264635
</InvalidClass>
46274636
</file>
4637+
<file src="lib/public/Util.php">
4638+
<InvalidReturnStatement occurrences="1">
4639+
<code>\OC_Helper::computerFileSize($str)</code>
4640+
</InvalidReturnStatement>
4641+
<InvalidReturnType occurrences="1">
4642+
<code>float|false</code>
4643+
</InvalidReturnType>
4644+
</file>
46284645
</files>

lib/private/legacy/OC_Helper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static function humanFileSize($bytes) {
9595
/**
9696
* Make a computer file size
9797
* @param string $str file size in human readable format
98-
* @return int|false a file size in bytes
98+
* @return float|bool a file size in bytes
9999
*
100100
* Makes 2kB to 2048.
101101
*
@@ -104,7 +104,7 @@ public static function humanFileSize($bytes) {
104104
public static function computerFileSize($str) {
105105
$str = strtolower($str);
106106
if (is_numeric($str)) {
107-
return (int)$str;
107+
return (float)$str;
108108
}
109109

110110
$bytes_array = [
@@ -131,7 +131,7 @@ public static function computerFileSize($str) {
131131

132132
$bytes = round($bytes);
133133

134-
return (int)$bytes;
134+
return $bytes;
135135
}
136136

137137
/**
@@ -605,7 +605,7 @@ public static function getStorageInfo($path, $rootInfo = null, $includeMountPoin
605605
/**
606606
* Get storage info including all mount points and quota
607607
*/
608-
private static function getGlobalStorageInfo(int $quota, IUser $user, IMountPoint $mount): array {
608+
private static function getGlobalStorageInfo(float $quota, IUser $user, IMountPoint $mount): array {
609609
$rootInfo = \OC\Files\Filesystem::getFileInfo('', 'ext');
610610
$used = $rootInfo['size'];
611611
if ($used < 0) {

lib/private/legacy/OC_Util.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public static function isDefaultExpireDateEnforced() {
158158
* Get the quota of a user
159159
*
160160
* @param IUser|null $user
161-
* @return int|\OCP\Files\FileInfo::SPACE_UNLIMITED|false Quota bytes
161+
* @return float Quota bytes
162162
*/
163163
public static function getUserQuota(?IUser $user) {
164164
if (is_null($user)) {

0 commit comments

Comments
 (0)