mirror of
https://github.com/nextcloud/server.git
synced 2026-04-23 15:21:00 -04:00
fix: skip caching lastSeenQuotaUsage for remote shares
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
parent
ec7c823182
commit
ca63574674
2 changed files with 11 additions and 2 deletions
|
|
@ -286,6 +286,7 @@ class DirectoryTest extends \Test\TestCase {
|
|||
->willReturnMap([
|
||||
['\OCA\Files_Sharing\SharedStorage', false],
|
||||
['\OC\Files\Storage\Wrapper\Quota', false],
|
||||
[\OCA\Files_Sharing\External\Storage::class, false],
|
||||
]);
|
||||
|
||||
$storage->expects($this->once())
|
||||
|
|
@ -341,6 +342,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())
|
||||
|
|
|
|||
|
|
@ -541,9 +541,16 @@ class OC_Helper {
|
|||
$relative = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* \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);
|
||||
$ownerDisplayName = '';
|
||||
if ($ownerId !== false) {
|
||||
|
||||
if ($isRemoteShare === false && $ownerId !== false) {
|
||||
$ownerDisplayName = \OC::$server->getUserManager()->getDisplayName($ownerId) ?? '';
|
||||
}
|
||||
|
||||
|
|
@ -565,7 +572,7 @@ class OC_Helper {
|
|||
'mountPoint' => trim($mountPoint, '/'),
|
||||
];
|
||||
|
||||
if ($ownerId && $path === '/') {
|
||||
if ($isRemoteShare === false && $ownerId !== false && $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