Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions lib/private/legacy/OC_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
use bantu\IniGetWrapper\IniGetWrapper;
use OC\Files\FilenameValidator;
use OC\Files\Filesystem;
use OC\Files\ObjectStore\HomeObjectStoreStorage;
use OC\Files\Storage\Home;
use OC\Files\Storage\Wrapper\Quota;
use OC\SystemConfig;
use OCA\Files_Sharing\External\Storage;
use OCP\Files\FileInfo;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\ISharedStorage;
use OCP\IBinaryFinder;
use OCP\ICacheFactory;
use OCP\IConfig;
Expand Down Expand Up @@ -190,24 +192,31 @@ public static function getStorageInfo($path, $rootInfo = null, $includeMountPoin
self::$quotaIncludeExternalStorage = false;
}
if (self::$quotaIncludeExternalStorage) {
if ($storage->instanceOfStorage('\OC\Files\Storage\Home')
if ($storage->instanceOfStorage(ISharedStorage::class)) {
// we must use the shared nodes owner,
// because if user A shared a file with user B and B shares this again,
// then the share owner is user B but the quota that this counts in is user A's quota.
Comment thread
susnux marked this conversation as resolved.
Outdated
/** @var ISharedStorage $storage */
$user = $storage->getShare()->getNode()->getOwner();
} elseif (
$storage->instanceOfStorage('\OC\Files\Storage\Home')
|| $storage->instanceOfStorage('\OC\Files\ObjectStore\HomeObjectStoreStorage')
) {
/** @var Home $storage */
/** @var Home|HomeObjectStoreStorage $storage */
$user = $storage->getUser();
} else {
$user = Server::get(IUserSession::class)->getUser();
}
$quota = $user?->getQuotaBytes() ?? FileInfo::SPACE_UNKNOWN;
if ($quota !== FileInfo::SPACE_UNLIMITED) {
if ($user !== null && $quota !== FileInfo::SPACE_UNLIMITED) {
// always get free space / total space from root + mount points
return self::getGlobalStorageInfo($quota, $user, $mount);
}
}

// TODO: need a better way to get total space from storage
if ($sourceStorage->instanceOfStorage('\OC\Files\Storage\Wrapper\Quota')) {
/** @var Quota $storage */
/** @var Quota $sourceStorage */
$quota = $sourceStorage->getQuota();
}
try {
Expand Down
Loading