mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 23:03:00 -04:00
Merge pull request #31837 from nextcloud/backport/31734/stable22
[stable22] dont re-query fileinfo when getting dav quota
This commit is contained in:
commit
379d0ca22b
3 changed files with 3 additions and 12 deletions
|
|
@ -327,8 +327,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
|
|||
return $this->quotaInfo;
|
||||
}
|
||||
try {
|
||||
$info = $this->fileView->getFileInfo($this->path, false);
|
||||
$storageInfo = \OC_Helper::getStorageInfo($this->info->getPath(), $info);
|
||||
$storageInfo = \OC_Helper::getStorageInfo($this->info->getPath(), $this->info, false);
|
||||
if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
|
||||
$free = \OCP\Files\FileInfo::SPACE_UNLIMITED;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -299,10 +299,6 @@ class DirectoryTest extends \Test\TestCase {
|
|||
->method('getMountPoint')
|
||||
->willReturn($mountPoint);
|
||||
|
||||
$this->view->expects($this->once())
|
||||
->method('getFileInfo')
|
||||
->willReturn($this->info);
|
||||
|
||||
$mountPoint->method('getMountPoint')
|
||||
->willReturn('/user/files/mymountpoint');
|
||||
|
||||
|
|
@ -344,10 +340,6 @@ class DirectoryTest extends \Test\TestCase {
|
|||
$mountPoint->method('getMountPoint')
|
||||
->willReturn('/user/files/mymountpoint');
|
||||
|
||||
$this->view->expects($this->once())
|
||||
->method('getFileInfo')
|
||||
->willReturn($this->info);
|
||||
|
||||
$dir = new Directory($this->view, $this->info);
|
||||
$this->assertEquals([200, 800], $dir->getQuotaInfo()); //200 used, 800 free
|
||||
}
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ class OC_Helper {
|
|||
* @return array
|
||||
* @throws \OCP\Files\NotFoundException
|
||||
*/
|
||||
public static function getStorageInfo($path, $rootInfo = null) {
|
||||
public static function getStorageInfo($path, $rootInfo = null, $includeMountPoints = true) {
|
||||
// return storage info without adding mount points
|
||||
$includeExtStorage = \OC::$server->getSystemConfig()->getValue('quota_include_external_storage', false);
|
||||
|
||||
|
|
@ -495,7 +495,7 @@ class OC_Helper {
|
|||
if (!$rootInfo instanceof \OCP\Files\FileInfo) {
|
||||
throw new \OCP\Files\NotFoundException();
|
||||
}
|
||||
$used = $rootInfo->getSize();
|
||||
$used = $rootInfo->getSize($includeMountPoints);
|
||||
if ($used < 0) {
|
||||
$used = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue