Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2021-07-01 12:42:34 +0300
committerGitHub <noreply@github.com>2021-07-01 12:42:34 +0300
commit54106a647e665a9bd3e8d28b8889447eb814d1b4 (patch)
treeb7d2add1a3330dc71185bfdb0081707f3c3fa26a
parent40e2e0fcd66ac8fc247963fe3d6d2b96f8d8c921 (diff)
parent4a5364a9b2235aa946176cb9ff37761e73951a61 (diff)
Merge pull request #27108 from nextcloud/backport/27043/stable20
[stable20] fix return value of getStorageInfo when 'quota_include_external_storage' is enabled
-rw-r--r--lib/private/legacy/OC_Helper.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php
index 44fbdffc092..da8acc6ffbe 100644
--- a/lib/private/legacy/OC_Helper.php
+++ b/lib/private/legacy/OC_Helper.php
@@ -44,6 +44,8 @@
*/
use bantu\IniGetWrapper\IniGetWrapper;
+use OCP\Files\Mount\IMountPoint;
+use OCP\IUser;
use Symfony\Component\Process\ExecutableFinder;
/**
@@ -517,7 +519,7 @@ class OC_Helper {
$quota = OC_Util::getUserQuota($user);
if ($quota !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
// always get free space / total space from root + mount points
- return self::getGlobalStorageInfo($quota);
+ return self::getGlobalStorageInfo($quota, $user, $mount);
}
}
@@ -569,11 +571,8 @@ class OC_Helper {
/**
* Get storage info including all mount points and quota
- *
- * @param int $quota
- * @return array
*/
- private static function getGlobalStorageInfo($quota) {
+ private static function getGlobalStorageInfo(int $quota, IUser $user, IMountPoint $mount): array {
$rootInfo = \OC\Files\Filesystem::getFileInfo('', 'ext');
$used = $rootInfo['size'];
if ($used < 0) {
@@ -593,12 +592,22 @@ class OC_Helper {
$relative = 0;
}
+ if (substr_count($mount->getMountPoint(), '/') < 3) {
+ $mountPoint = '';
+ } else {
+ [,,,$mountPoint] = explode('/', $mount->getMountPoint(), 4);
+ }
+
return [
'free' => $free,
'used' => $used,
'total' => $total,
'relative' => $relative,
- 'quota' => $quota
+ 'quota' => $quota,
+ 'owner' => $user->getUID(),
+ 'ownerDisplayName' => $user->getDisplayName(),
+ 'mountType' => $mount->getMountType(),
+ 'mountPoint' => trim($mountPoint, '/'),
];
}