From 5242f6d51f232b3444e963e51f22114bdb6bc352 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Mon, 24 Mar 2014 01:05:23 +0100 Subject: [PATCH] Added gravatar cache reset --- .../files/lib/data/user/avatar/Gravatar.class.php | 2 +- .../install/files/lib/form/AvatarEditForm.class.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/data/user/avatar/Gravatar.class.php b/wcfsetup/install/files/lib/data/user/avatar/Gravatar.class.php index ef482ef7b3..7de3a61172 100644 --- a/wcfsetup/install/files/lib/data/user/avatar/Gravatar.class.php +++ b/wcfsetup/install/files/lib/data/user/avatar/Gravatar.class.php @@ -2,8 +2,8 @@ namespace wcf\data\user\avatar; use wcf\system\exception\SystemException; use wcf\system\request\LinkHandler; -use wcf\util\FileUtil; use wcf\system\WCF; +use wcf\util\FileUtil; /** * Represents a gravatar. diff --git a/wcfsetup/install/files/lib/form/AvatarEditForm.class.php b/wcfsetup/install/files/lib/form/AvatarEditForm.class.php index c13fb02e1d..7ff7cf32e5 100644 --- a/wcfsetup/install/files/lib/form/AvatarEditForm.class.php +++ b/wcfsetup/install/files/lib/form/AvatarEditForm.class.php @@ -121,6 +121,17 @@ class AvatarEditForm extends AbstractForm { )); $this->objectAction->executeAction(); + // reset gravatar cache + if ($this->avatarType == 'gravatar') { + $pattern = WCF_DIR . sprintf(Gravatar::GRAVATAR_CACHE_LOCATION, md5(mb_strtolower(WCF::getUser()->email)), '*'); + $files = glob($pattern); + if (!empty($files)) { + foreach ($files as $file) { + @unlink($file); + } + } + } + $this->saved(); WCF::getTPL()->assign('success', true); } -- 2.20.1