diff options
Diffstat (limited to 'lib/private/Avatar.php')
-rw-r--r-- | lib/private/Avatar.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/private/Avatar.php b/lib/private/Avatar.php index 80691774b64..9e8bd0136c2 100644 --- a/lib/private/Avatar.php +++ b/lib/private/Avatar.php @@ -34,6 +34,7 @@ use OCP\Files\File; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OCP\IAvatar; +use OCP\IConfig; use OCP\IImage; use OCP\IL10N; use OC_Image; @@ -52,6 +53,8 @@ class Avatar implements IAvatar { private $user; /** @var ILogger */ private $logger; + /** @var IConfig */ + private $config; /** * constructor @@ -60,12 +63,18 @@ class Avatar implements IAvatar { * @param IL10N $l * @param User $user * @param ILogger $logger + * @param IConfig $config */ - public function __construct (Folder $folder, IL10N $l, $user, ILogger $logger) { + public function __construct(Folder $folder, + IL10N $l, + $user, + ILogger $logger, + IConfig $config) { $this->folder = $folder; $this->l = $l; $this->user = $user; $this->logger = $logger; + $this->config = $config; } /** @@ -137,6 +146,9 @@ class Avatar implements IAvatar { $regex = '/^avatar\.([0-9]+\.)?(jpg|png)$/'; $avatars = $this->folder->getDirectoryListing(); + $this->config->setUserValue($this->user->getUID(), 'avatar', 'version', + (int)$this->config->getUserValue($this->user->getUID(), 'avatar', 'version', 0) + 1); + foreach ($avatars as $avatar) { if (preg_match($regex, $avatar->getName())) { $avatar->delete(); |