summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2021-05-25 21:57:23 +0200
committerGitHub <noreply@github.com>2021-05-25 21:57:23 +0200
commit6ed728d76c12358314fa3dc5b818d0f38b076745 (patch)
tree4e3c3006613e273f0db4838a249847313c8a5289 /lib
parent1b47886abb85d97fd6825db6c4edef3fbd278881 (diff)
parent7e2248727888ed8cdf539d4a72388a83575f731d (diff)
downloadnextcloud-server-6ed728d76c12358314fa3dc5b818d0f38b076745.tar.gz
nextcloud-server-6ed728d76c12358314fa3dc5b818d0f38b076745.zip
Merge pull request #27043 from nextcloud/storage-info-include-external
fix return value of getStorageInfo when 'quota_include_external_storage' is enabled
Diffstat (limited to 'lib')
-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 5249416654e..7193f9c4b70 100644
--- a/lib/private/legacy/OC_Helper.php
+++ b/lib/private/legacy/OC_Helper.php
@@ -45,6 +45,8 @@
*/
use bantu\IniGetWrapper\IniGetWrapper;
+use OCP\Files\Mount\IMountPoint;
+use OCP\IUser;
use Symfony\Component\Process\ExecutableFinder;
/**
@@ -518,7 +520,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);
}
}
@@ -570,11 +572,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) {
@@ -594,12 +593,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, '/'),
];
}