Skip to content

Commit aed78c2

Browse files
committed
Backport of #864
* 2634206 * 264aaf9
1 parent edf08f5 commit aed78c2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/private/util.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ public static function setupFS($user = '') {
166166

167167
// install storage availability wrapper, before most other wrappers
168168
\OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, $storage) {
169+
/** @var \OCP\Files\Storage $storage */
169170
if (!$storage->instanceOfStorage('\OC\Files\Storage\Shared') && !$storage->isLocal()) {
170171
return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]);
171172
}
@@ -283,16 +284,19 @@ public static function isDefaultExpireDateEnforced() {
283284
/**
284285
* Get the quota of a user
285286
*
286-
* @param string $user
287+
* @param string $userId
287288
* @return int Quota bytes
288289
*/
289-
public static function getUserQuota($user) {
290-
$userQuota = \OC::$server->getUserManager()->get($user)->getQuota();
291-
if($userQuota === 'none') {
290+
public static function getUserQuota($userId) {
291+
$user = \OC::$server->getUserManager()->get($userId);
292+
if (is_null($user)) {
292293
return \OCP\Files\FileInfo::SPACE_UNLIMITED;
293-
}else{
294-
return OC_Helper::computerFileSize($userQuota);
295294
}
295+
$userQuota = $user->getQuota();
296+
if($userQuota === 'none') {
297+
return \OCP\Files\FileInfo::SPACE_UNLIMITED;
298+
}
299+
return OC_Helper::computerFileSize($userQuota);
296300
}
297301

298302
/**

0 commit comments

Comments
 (0)