aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-08-18 09:30:47 +0200
committerGitHub <noreply@github.com>2016-08-18 09:30:47 +0200
commit1927c28b9f4f31c27eec1f3865fbed84b73822d0 (patch)
tree994e52cd2a4ee3fda04cfe6eb57a5afade15b500 /lib/private
parent34ee64c853b4c92630c11fa2b93911c61a0e45d7 (diff)
parent29565ec4239ef20c5a8ab360233482de0358a914 (diff)
downloadnextcloud-server-1927c28b9f4f31c27eec1f3865fbed84b73822d0.tar.gz
nextcloud-server-1927c28b9f4f31c27eec1f3865fbed84b73822d0.zip
Merge pull request #910 from nextcloud/stable10_864
[Stable10] Ensure the user exists before calling a method on it
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/legacy/util.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php
index a1102630755..a975da39271 100644
--- a/lib/private/legacy/util.php
+++ b/lib/private/legacy/util.php
@@ -165,6 +165,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]);
}
@@ -290,16 +291,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();
+ public static function getUserQuota($userId) {
+ $user = \OC::$server->getUserManager()->get($userId);
+ if (is_null($user)) {
+ return \OCP\Files\FileInfo::SPACE_UNLIMITED;
+ }
+ $userQuota = $user->getQuota();
if($userQuota === 'none') {
return \OCP\Files\FileInfo::SPACE_UNLIMITED;
- }else{
- return OC_Helper::computerFileSize($userQuota);
}
+ return OC_Helper::computerFileSize($userQuota);
}
/**