-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly calculate used space for quota with external storage #4357
Conversation
@Ardinis, thanks for your PR! By analyzing the history of the files in this pull request, we identified @icewind1991, @MorrisJobke and @blizzz to be potential reviewers. |
lib/private/legacy/helper.php
Outdated
@@ -537,7 +537,7 @@ public static function getStorageInfo($path, $rootInfo = null) { | |||
$includeExtStorage = \OC::$server->getSystemConfig()->getValue('quota_include_external_storage', false); | |||
|
|||
if (!$rootInfo) { | |||
$rootInfo = \OC\Files\Filesystem::getFileInfo($path, false); | |||
$rootInfo = \OC\Files\Filesystem::getFileInfo($path, $includeExtStorage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be 'ext'
, when using true
it also includes incoming shares
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure of what you are meaning here.
By using $includeExtStorage external storage are counted in quota calculation for the used part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can pass 'ext'
as the seccond argument of getFileInfo
to have it include external storages but not shares.
When passing true
it includes both shares and external storages
Codecov Report
@@ Coverage Diff @@
## master #4357 +/- ##
=============================================
- Coverage 54.08% 31.15% -22.94%
- Complexity 21589 21629 +40
=============================================
Files 1327 1328 +1
Lines 82303 82188 -115
Branches 1305 1311 +6
=============================================
- Hits 44511 25602 -18909
- Misses 37792 56586 +18794
|
lib/private/legacy/helper.php
Outdated
@@ -537,7 +537,7 @@ public static function getStorageInfo($path, $rootInfo = null) { | |||
$includeExtStorage = \OC::$server->getSystemConfig()->getValue('quota_include_external_storage', false); | |||
|
|||
if (!$rootInfo) { | |||
$rootInfo = \OC\Files\Filesystem::getFileInfo($path, false); | |||
$rootInfo = \OC\Files\Filesystem::getFileInfo($path, 'ext'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should still only apply external storages when the config is set.
$rootInfo = \OC\Files\Filesystem::getFileInfo($path, $includeExtStorage ? 'ext' : false);
@Ardinis could you address the comments of @icewind1991 ? |
Could you also have a look at the failing unit test:
And could you squash all your commits into one, because 3 commits is a bit much for a 1 line change 😉 And if this commit then also would have a sign-off I would be more than happy :) https://github.com/nextcloud/server/blob/master/CONTRIBUTING.md#sign-your-work |
I fixed the unit tests: #4816 |
issue #4348