3737use OCP \Files \Storage \IStorage ;
3838
3939class Quota extends Wrapper {
40-
41- /**
42- * @var int $quota
43- */
40+ /** @var int|float int on 64bits, float on 32bits for bigint */
4441 protected $ quota ;
4542
4643 /**
@@ -61,15 +58,16 @@ public function __construct($parameters) {
6158 }
6259
6360 /**
64- * @return int quota value
61+ * @return int|float quota value
6562 */
6663 public function getQuota () {
6764 return $ this ->quota ;
6865 }
6966
7067 /**
7168 * @param string $path
72- * @param \OC\Files\Storage\Storage $storage
69+ * @param IStorage $storage
70+ * @return int|float
7371 */
7472 protected function getSize ($ path , $ storage = null ) {
7573 if ($ this ->config ->getValue ('quota_include_external_storage ' , false )) {
@@ -97,7 +95,7 @@ protected function getSize($path, $storage = null) {
9795 * Get free space as limited by the quota
9896 *
9997 * @param string $path
100- * @return int|bool
98+ * @return int|float| bool
10199 */
102100 public function free_space ($ path ) {
103101 if ($ this ->quota < 0 || strpos ($ path , 'cache ' ) === 0 || strpos ($ path , 'uploads ' ) === 0 ) {
@@ -125,7 +123,7 @@ public function free_space($path) {
125123 *
126124 * @param string $path
127125 * @param mixed $data
128- * @return int|false
126+ * @return int|float| false
129127 */
130128 public function file_put_contents ($ path , $ data ) {
131129 $ free = $ this ->free_space ($ path );
@@ -165,7 +163,7 @@ public function fopen($path, $mode) {
165163 // don't apply quota for part files
166164 if (!$ this ->isPartFile ($ path )) {
167165 $ free = $ this ->free_space ($ path );
168- if ($ source && is_int ($ free ) && $ free >= 0 && $ mode !== 'r ' && $ mode !== 'rb ' ) {
166+ if ($ source && ( is_int ($ free) || is_float ( $ free ) ) && $ free >= 0 && $ mode !== 'r ' && $ mode !== 'rb ' ) {
169167 // only apply quota for files, not metadata, trash or others
170168 if ($ this ->shouldApplyQuota ($ path )) {
171169 return \OC \Files \Stream \Quota::wrap ($ source , $ free );
@@ -179,7 +177,7 @@ public function fopen($path, $mode) {
179177 * Checks whether the given path is a part file
180178 *
181179 * @param string $path Path that may identify a .part file
182- * @return string File path without .part extension
180+ * @return bool
183181 * @note this is needed for reusing keys
184182 */
185183 private function isPartFile ($ path ) {
0 commit comments