4141class Quota extends Wrapper {
4242 /** @var callable|null */
4343 protected $ quotaCallback ;
44- protected ?int $ quota ;
44+ /** @var int|float|null int on 64bits, float on 32bits for bigint */
45+ protected int |float |null $ quota ;
4546 protected string $ sizeRoot ;
4647 private SystemConfig $ config ;
4748
@@ -57,9 +58,9 @@ public function __construct($parameters) {
5758 }
5859
5960 /**
60- * @return int quota value
61+ * @return int|float quota value
6162 */
62- public function getQuota (): int {
63+ public function getQuota (): int | float {
6364 if ($ this ->quota === null ) {
6465 $ quotaCallback = $ this ->quotaCallback ;
6566 if ($ quotaCallback === null ) {
@@ -77,7 +78,8 @@ private function hasQuota(): bool {
7778
7879 /**
7980 * @param string $path
80- * @param \OC\Files\Storage\Storage $storage
81+ * @param IStorage $storage
82+ * @return int|float
8183 */
8284 protected function getSize ($ path , $ storage = null ) {
8385 if ($ this ->config ->getValue ('quota_include_external_storage ' , false )) {
@@ -101,7 +103,7 @@ protected function getSize($path, $storage = null) {
101103 * Get free space as limited by the quota
102104 *
103105 * @param string $path
104- * @return int|bool
106+ * @return int|float| bool
105107 */
106108 public function free_space ($ path ) {
107109 if (!$ this ->hasQuota ()) {
@@ -128,7 +130,7 @@ public function free_space($path) {
128130 *
129131 * @param string $path
130132 * @param mixed $data
131- * @return int|false
133+ * @return int|float| false
132134 */
133135 public function file_put_contents ($ path , $ data ) {
134136 if (!$ this ->hasQuota ()) {
@@ -177,7 +179,7 @@ public function fopen($path, $mode) {
177179 // don't apply quota for part files
178180 if (!$ this ->isPartFile ($ path )) {
179181 $ free = $ this ->free_space ($ path );
180- if ($ source && is_int ($ free ) && $ free >= 0 && $ mode !== 'r ' && $ mode !== 'rb ' ) {
182+ if ($ source && ( is_int ($ free) || is_float ( $ free ) ) && $ free >= 0 && $ mode !== 'r ' && $ mode !== 'rb ' ) {
181183 // only apply quota for files, not metadata, trash or others
182184 if ($ this ->shouldApplyQuota ($ path )) {
183185 return \OC \Files \Stream \Quota::wrap ($ source , $ free );
@@ -192,7 +194,7 @@ public function fopen($path, $mode) {
192194 * Checks whether the given path is a part file
193195 *
194196 * @param string $path Path that may identify a .part file
195- * @return string File path without .part extension
197+ * @return bool
196198 * @note this is needed for reusing keys
197199 */
198200 private function isPartFile ($ path ) {
0 commit comments