From 80191906b3a1ad42f73317158b20555591aae6bf Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Tue, 5 Mar 2024 12:09:36 +0100 Subject: feat: Store last known quota usage for a user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/private/legacy/OC_Helper.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php index 37fbf7f5f8f..2e95d5976cb 100644 --- a/lib/private/legacy/OC_Helper.php +++ b/lib/private/legacy/OC_Helper.php @@ -596,6 +596,11 @@ class OC_Helper { 'mountPoint' => trim($mountPoint, '/'), ]; + if ($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); + } + $memcache->set($cacheKey, $info, 5 * 60); return $info; -- cgit v1.2.3 From 29a648ab73a242e97505547c35b812658751da23 Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Wed, 6 Mar 2024 18:36:08 +0100 Subject: fix: Avoid calling setUserValue on null user id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/private/legacy/OC_Helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php index 2e95d5976cb..9a12bd50e0e 100644 --- a/lib/private/legacy/OC_Helper.php +++ b/lib/private/legacy/OC_Helper.php @@ -596,7 +596,7 @@ class OC_Helper { 'mountPoint' => trim($mountPoint, '/'), ]; - if ($path === '/') { + if ($ownerId && $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); } -- cgit v1.2.3