mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
Merge pull request #51523 from nextcloud/backport/51389/stable30
[stable30] fix: skip caching lastSeenQuotaUsage for remote shares
This commit is contained in:
commit
559d6e8639
2 changed files with 22 additions and 5 deletions
|
|
@ -283,8 +283,9 @@ class DirectoryTest extends \Test\TestCase {
|
|||
$storage->expects($this->any())
|
||||
->method('instanceOfStorage')
|
||||
->willReturnMap([
|
||||
'\OCA\Files_Sharing\SharedStorage' => false,
|
||||
'\OC\Files\Storage\Wrapper\Quota' => false,
|
||||
['\OCA\Files_Sharing\SharedStorage', false],
|
||||
['\OC\Files\Storage\Wrapper\Quota', false],
|
||||
[\OCA\Files_Sharing\External\Storage::class, false],
|
||||
]);
|
||||
|
||||
$storage->expects($this->once())
|
||||
|
|
@ -314,6 +315,10 @@ class DirectoryTest extends \Test\TestCase {
|
|||
->method('getRelativePath')
|
||||
->willReturn('/foo');
|
||||
|
||||
$this->info->expects($this->once())
|
||||
->method('getInternalPath')
|
||||
->willReturn('/foo');
|
||||
|
||||
$mountPoint->method('getMountPoint')
|
||||
->willReturn('/user/files/mymountpoint');
|
||||
|
||||
|
|
@ -336,6 +341,7 @@ class DirectoryTest extends \Test\TestCase {
|
|||
->willReturnMap([
|
||||
['\OCA\Files_Sharing\SharedStorage', false],
|
||||
['\OC\Files\Storage\Wrapper\Quota', true],
|
||||
[\OCA\Files_Sharing\External\Storage::class, false],
|
||||
]);
|
||||
|
||||
$storage->expects($this->once())
|
||||
|
|
@ -358,6 +364,10 @@ class DirectoryTest extends \Test\TestCase {
|
|||
->method('getMountPoint')
|
||||
->willReturn($mountPoint);
|
||||
|
||||
$this->info->expects($this->once())
|
||||
->method('getInternalPath')
|
||||
->willReturn('/foo');
|
||||
|
||||
$mountPoint->method('getMountPoint')
|
||||
->willReturn('/user/files/mymountpoint');
|
||||
|
||||
|
|
|
|||
|
|
@ -541,10 +541,17 @@ class OC_Helper {
|
|||
$relative = 0;
|
||||
}
|
||||
|
||||
/** @var string $ownerId */
|
||||
/*
|
||||
* \OCA\Files_Sharing\External\Storage returns the cloud ID as the owner for the storage.
|
||||
* It is unnecessary to query the user manager for the display name, as it won't have this information.
|
||||
*/
|
||||
$isRemoteShare = $storage->instanceOfStorage(\OCA\Files_Sharing\External\Storage::class);
|
||||
|
||||
$ownerId = $storage->getOwner($path);
|
||||
$hasOwnerId = $ownerId !== false && $ownerId !== null;
|
||||
$ownerDisplayName = '';
|
||||
if ($ownerId) {
|
||||
|
||||
if ($isRemoteShare === false && $hasOwnerId) {
|
||||
$ownerDisplayName = \OC::$server->getUserManager()->getDisplayName($ownerId) ?? '';
|
||||
}
|
||||
|
||||
|
|
@ -566,7 +573,7 @@ class OC_Helper {
|
|||
'mountPoint' => trim($mountPoint, '/'),
|
||||
];
|
||||
|
||||
if ($ownerId && $path === '/') {
|
||||
if ($isRemoteShare === false && $hasOwnerId && $path === '/') {
|
||||
// If path is root, store this as last known quota usage for this user
|
||||
\OCP\Server::get(\OCP\IConfig::class)->setUserValue($ownerId, 'files', 'lastSeenQuotaUsage', (string)$relative);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue