summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-01-08 09:41:25 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-01-08 09:41:25 +0100
commita1a8a06042e1f420fbdc6ff8cc1abead1d60c2ad (patch)
tree903a6d66cac692bcc68760c87d566faa43b75ea7 /lib
parent88c4cba1f52a63da78da56e50ac9f22a643a5be0 (diff)
parent4e6f6518ff9aec0b838ce0c43a9d3f880b4464ad (diff)
downloadnextcloud-server-a1a8a06042e1f420fbdc6ff8cc1abead1d60c2ad.tar.gz
nextcloud-server-a1a8a06042e1f420fbdc6ff8cc1abead1d60c2ad.zip
Merge pull request #21527 from owncloud/remove_all_avatars
Remove all cache avatars on avatar deletion
Diffstat (limited to 'lib')
-rw-r--r--lib/private/avatar.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/private/avatar.php b/lib/private/avatar.php
index c87facd25da..966e4903649 100644
--- a/lib/private/avatar.php
+++ b/lib/private/avatar.php
@@ -124,12 +124,14 @@ class Avatar implements \OCP\IAvatar {
* @return void
*/
public function remove () {
- try {
- $this->folder->get('avatar.jpg')->delete();
- } catch (\OCP\Files\NotFoundException $e) {}
- try {
- $this->folder->get('avatar.png')->delete();
- } catch (\OCP\Files\NotFoundException $e) {}
+ $regex = '/^avatar\.([0-9]+\.)?(jpg|png)$/';
+ $avatars = $this->folder->search('avatar');
+
+ foreach ($avatars as $avatar) {
+ if (preg_match($regex, $avatar->getName())) {
+ $avatar->delete();
+ }
+ }
}
/**