summaryrefslogtreecommitdiffstats
path: root/lib/private/AvatarManager.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-11-08 10:28:09 +0100
committerGitHub <noreply@github.com>2018-11-08 10:28:09 +0100
commit25fe324f41e10083e1e85895a03603829af1b533 (patch)
tree358c31fe923275808b023e4c92214a5492cc9e6f /lib/private/AvatarManager.php
parent55f0c2ac3bcbd6e1005f9794d238b22103a4941d (diff)
parenta9eef37456da6728d3c0747c7c75f501f64fe909 (diff)
downloadnextcloud-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.php16
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');
+ }
+ }
}