diff options
author | Vincent Petry <pvince81@owncloud.com> | 2013-11-21 12:17:47 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2013-11-21 12:17:47 +0100 |
commit | 69e8e7dbd5039652cceb078025248c308ffd0d55 (patch) | |
tree | 754057f2db112e38f98c0b601be776d28a9564fb /lib/private/util.php | |
parent | 356eef07398f8829a2558eee809599be60441b59 (diff) | |
download | nextcloud-server-69e8e7dbd5039652cceb078025248c308ffd0d55.tar.gz nextcloud-server-69e8e7dbd5039652cceb078025248c308ffd0d55.zip |
Now using the "Home" storage detection approach for quota
To find out whether to apply a quota, we now try and detect whether the
storage to wrap is a "Home" storage.
Diffstat (limited to 'lib/private/util.php')
-rwxr-xr-x | lib/private/util.php | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/private/util.php b/lib/private/util.php index 88f1f197b5d..959d36a89e9 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -57,21 +57,11 @@ class OC_Util { // set up quota for home storages, even for other users // which can happen when using sharing - if (strlen($mountPoint) > 1) { - // the user name will be extracted from the mountpoint - // with the format '/username/' (no suffix) - $user = null; - // find second separator - $nextSepPos = strpos($mountPoint, '/', 1); - // next separator is the last one, format matches - if ($nextSepPos === strlen($mountPoint) - 1) { - $user = substr($mountPoint, 1, $nextSepPos - 1); - } - if ($user) { - $quota = OC_Util::getUserQuota($user); - if ($quota !== \OC\Files\SPACE_UNLIMITED) { - return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota)); - } + if ($storage instanceof \OC\Files\Storage\Home) { + $user = $storage->getUser()->getUID(); + $quota = OC_Util::getUserQuota($user); + if ($quota !== \OC\Files\SPACE_UNLIMITED) { + return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota)); } } |