diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2018-11-08 10:28:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-08 10:28:09 +0100 |
commit | 25fe324f41e10083e1e85895a03603829af1b533 (patch) | |
tree | 358c31fe923275808b023e4c92214a5492cc9e6f /lib/private/AvatarManager.php | |
parent | 55f0c2ac3bcbd6e1005f9794d238b22103a4941d (diff) | |
parent | a9eef37456da6728d3c0747c7c75f501f64fe909 (diff) | |
download | nextcloud-server-25fe324f41e10083e1e85895a03603829af1b533.tar.gz nextcloud-server-25fe324f41e10083e1e85895a03603829af1b533.zip |
Merge pull request #12313 from nextcloud/generated-avatar-major-cleanup
Clear avatar cache with frontend repair
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'); + } + } } |