fix: clear in-memory cached mounts for user when adding/removing mounts

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2026-02-18 16:57:11 +01:00
parent d2f21352c6
commit 4b00db977f
No known key found for this signature in database
GPG key ID: 42B69D8A64526EFB

View file

@ -536,6 +536,12 @@ class UserMountCache implements IUserMountCache {
$query->delete('mounts')
->where($query->expr()->eq('mount_point', $query->createNamedParameter($mountPoint)));
$query->executeStatement();
$parts = explode('/', $mountPoint);
if (count($parts) > 3) {
[, $userId] = $parts;
unset($this->mountsForUsers[$userId]);
}
}
public function addMount(IUser $user, string $mountPoint, ICacheEntry $rootCacheEntry, string $mountProvider, ?int $mountId = null): void {
@ -553,6 +559,7 @@ class UserMountCache implements IUserMountCache {
try {
$query->executeStatement();
unset($this->mountsForUsers[$user->getUID()]);
} catch (DbalException $e) {
if ($e->getReason() !== DbalException::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
throw $e;