summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2023-09-05 19:11:28 +0200
committerGitHub <noreply@github.com>2023-09-05 19:11:28 +0200
commit4230aa8dd388dca084fa917c5fc50dbf1c3e539f (patch)
tree47c8513c03f164a7759ebf88c5f4dfaa398a8d5a /lib/private
parentf756d8f70a4a33a8ed6f5a0f7031f4461216efc1 (diff)
parent61e61fb9c3b62b5e25ae50b0f47f71bd229ea839 (diff)
downloadnextcloud-server-4230aa8dd388dca084fa917c5fc50dbf1c3e539f.tar.gz
nextcloud-server-4230aa8dd388dca084fa917c5fc50dbf1c3e539f.zip
Merge pull request #40085 from nextcloud/backport/40077/stable26
[stable26] fix(cache): Remove displayname cache entry on delete
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Group/DisplayNameCache.php6
-rw-r--r--lib/private/User/DisplayNameCache.php6
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/private/Group/DisplayNameCache.php b/lib/private/Group/DisplayNameCache.php
index d724b6caf0e..4eb8211be6e 100644
--- a/lib/private/Group/DisplayNameCache.php
+++ b/lib/private/Group/DisplayNameCache.php
@@ -29,6 +29,7 @@ use OCP\Cache\CappedMemoryCache;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\Group\Events\GroupChangedEvent;
+use OCP\Group\Events\GroupDeletedEvent;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IGroupManager;
@@ -83,5 +84,10 @@ class DisplayNameCache implements IEventListener {
$this->cache[$groupId] = $newDisplayName;
$this->memCache->set($groupId, $newDisplayName, 60 * 10); // 10 minutes
}
+ if ($event instanceof GroupDeletedEvent) {
+ $groupId = $event->getGroup()->getGID();
+ unset($this->cache[$groupId]);
+ $this->memCache->remove($groupId);
+ }
}
}
diff --git a/lib/private/User/DisplayNameCache.php b/lib/private/User/DisplayNameCache.php
index 5d1cc8940d7..6ee74cc9f6c 100644
--- a/lib/private/User/DisplayNameCache.php
+++ b/lib/private/User/DisplayNameCache.php
@@ -29,6 +29,7 @@ use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IUserManager;
use OCP\User\Events\UserChangedEvent;
+use OCP\User\Events\UserDeletedEvent;
/**
* Class that cache the relation UserId -> Display name
@@ -81,5 +82,10 @@ class DisplayNameCache implements IEventListener {
$this->cache[$userId] = $newDisplayName;
$this->memCache->set($userId, $newDisplayName, 60 * 10); // 10 minutes
}
+ if ($event instanceof UserDeletedEvent) {
+ $userId = $event->getUser()->getUID();
+ unset($this->cache[$userId]);
+ $this->memCache->remove($userId);
+ }
}
}