Merge pull request #4816 from nextcloud/Ardinis-quota-files_external

Correctly calculate used space for quota with external storage
This commit is contained in:
Morris Jobke 2017-05-12 11:33:54 -05:00 committed by GitHub
commit 3bf9503070
2 changed files with 4 additions and 4 deletions

View File

@ -537,7 +537,7 @@ class OC_Helper {
$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 ? 'ext' : false);
}
if (!$rootInfo instanceof \OCP\Files\FileInfo) {
throw new \OCP\Files\NotFoundException();

View File

@ -158,9 +158,9 @@ class HelperStorageTest extends \Test\TestCase {
$config->setSystemValue('quota_include_external_storage', 'true');
$storageInfo = \OC_Helper::getStorageInfo('');
$this->assertEquals(12, $storageInfo['free']);
$this->assertEquals(5, $storageInfo['used']);
$this->assertEquals(17, $storageInfo['total']);
$this->assertEquals(12, $storageInfo['free'], '12 bytes free in home storage');
$this->assertEquals(22, $storageInfo['used'], '5 bytes of home storage and 17 bytes of the temporary storage are used');
$this->assertEquals(34, $storageInfo['total'], '5 bytes used and 12 bytes free in home storage as well as 17 bytes used in temporary storage');
$config->setSystemValue('quota_include_external_storage', $oldConfig);
}