fix return value of getStorageInfo when 'quota_include_external_storage' is enabled
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
6814ac03c1
commit
3775b862a9
|
@ -45,6 +45,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use bantu\IniGetWrapper\IniGetWrapper;
|
use bantu\IniGetWrapper\IniGetWrapper;
|
||||||
|
use OCP\Files\Mount\IMountPoint;
|
||||||
|
use OCP\IUser;
|
||||||
use Symfony\Component\Process\ExecutableFinder;
|
use Symfony\Component\Process\ExecutableFinder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -518,7 +520,7 @@ class OC_Helper {
|
||||||
$quota = OC_Util::getUserQuota($user);
|
$quota = OC_Util::getUserQuota($user);
|
||||||
if ($quota !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
|
if ($quota !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
|
||||||
// always get free space / total space from root + mount points
|
// 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
|
* 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');
|
$rootInfo = \OC\Files\Filesystem::getFileInfo('', 'ext');
|
||||||
$used = $rootInfo['size'];
|
$used = $rootInfo['size'];
|
||||||
if ($used < 0) {
|
if ($used < 0) {
|
||||||
|
@ -594,12 +593,22 @@ class OC_Helper {
|
||||||
$relative = 0;
|
$relative = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (substr_count($mount->getMountPoint(), '/') < 3) {
|
||||||
|
$mountPoint = '';
|
||||||
|
} else {
|
||||||
|
[,,,$mountPoint] = explode('/', $mount->getMountPoint(), 4);
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'free' => $free,
|
'free' => $free,
|
||||||
'used' => $used,
|
'used' => $used,
|
||||||
'total' => $total,
|
'total' => $total,
|
||||||
'relative' => $relative,
|
'relative' => $relative,
|
||||||
'quota' => $quota
|
'quota' => $quota,
|
||||||
|
'owner' => $user->getUID(),
|
||||||
|
'ownerDisplayName' => $user->getDisplayName(),
|
||||||
|
'mountType' => $mount->getMountType(),
|
||||||
|
'mountPoint' => trim($mountPoint, '/'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue