diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-11-06 15:43:53 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-11-08 08:31:21 +0100 |
commit | a9eef37456da6728d3c0747c7c75f501f64fe909 (patch) | |
tree | cdfeb29fc7187d83481eed16144949a266695d94 /lib/private/AvatarManager.php | |
parent | 54a30a4b81700570303eaae03810f6ef553d66a2 (diff) | |
download | nextcloud-server-a9eef37456da6728d3c0747c7c75f501f64fe909.tar.gz nextcloud-server-a9eef37456da6728d3c0747c7c75f501f64fe909.zip |
Clear avatar cache with frontend repair
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib/private/AvatarManager.php')
-rw-r--r-- | lib/private/AvatarManager.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/private/AvatarManager.php b/lib/private/AvatarManager.php index eb455642101..8fd64bc2206 100644 --- a/lib/private/AvatarManager.php +++ b/lib/private/AvatarManager.php @@ -104,4 +104,20 @@ class AvatarManager implements IAvatarManager { return new Avatar($folder, $this->l, $user, $this->logger, $this->config); } + + /** + * Clear generated avatars + */ + public function clearCachedAvatars() { + $users = $this->config->getUsersForUserValue('avatar', 'generated', 'true'); + foreach($users as $userId) { + try { + $folder = $this->appData->getFolder($userId); + $folder->delete(); + } catch (NotFoundException $e) { + $this->logger->debug("No cache for the user $userId. Ignoring..."); + } + $this->config->setUserValue($userId, 'avatar', 'generated', 'false'); + } + } } |