summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-08-17 15:55:02 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-08-17 15:55:02 +0200
commitaed78c242dcbf1233c10487aa7c236d51fb8f5bd (patch)
treedceddaea06a3729f0607343cea53c99708fb2f9e /lib
parentedf08f5eef7da9019afcc5c9c13f39f78db858a2 (diff)
downloadnextcloud-server-aed78c242dcbf1233c10487aa7c236d51fb8f5bd.tar.gz
nextcloud-server-aed78c242dcbf1233c10487aa7c236d51fb8f5bd.zip
Backport of #864
* 26342061b9b9767577a0f5eee16afd36e3b8b0b1 * 264aaf9ffaf71b2fc8a6bd2f5d5c9bf4a6d403de
Diffstat (limited to 'lib')
-rw-r--r--lib/private/util.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/private/util.php b/lib/private/util.php
index ef0b840342a..421c79b0257 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -166,6 +166,7 @@ class OC_Util {
// install storage availability wrapper, before most other wrappers
\OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, $storage) {
+ /** @var \OCP\Files\Storage $storage */
if (!$storage->instanceOfStorage('\OC\Files\Storage\Shared') && !$storage->isLocal()) {
return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]);
}
@@ -283,16 +284,19 @@ class OC_Util {
/**
* Get the quota of a user
*
- * @param string $user
+ * @param string $userId
* @return int Quota bytes
*/
- public static function getUserQuota($user) {
- $userQuota = \OC::$server->getUserManager()->get($user)->getQuota();
- if($userQuota === 'none') {
+ public static function getUserQuota($userId) {
+ $user = \OC::$server->getUserManager()->get($userId);
+ if (is_null($user)) {
return \OCP\Files\FileInfo::SPACE_UNLIMITED;
- }else{
- return OC_Helper::computerFileSize($userQuota);
}
+ $userQuota = $user->getQuota();
+ if($userQuota === 'none') {
+ return \OCP\Files\FileInfo::SPACE_UNLIMITED;
+ }
+ return OC_Helper::computerFileSize($userQuota);
}
/**