summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Avatar.php14
-rw-r--r--lib/private/AvatarManager.php11
-rw-r--r--lib/private/Server.php3
-rw-r--r--lib/private/TemplateLayout.php1
-rw-r--r--lib/public/AppFramework/Http/Response.php3
5 files changed, 26 insertions, 6 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();
diff --git a/lib/private/AvatarManager.php b/lib/private/AvatarManager.php
index e461a70608b..0eabc3a1754 100644
--- a/lib/private/AvatarManager.php
+++ b/lib/private/AvatarManager.php
@@ -30,6 +30,7 @@ namespace OC;
use OCP\Files\Folder;
use OCP\Files\NotFoundException;
use OCP\IAvatarManager;
+use OCP\IConfig;
use OCP\ILogger;
use OCP\IUserManager;
use OCP\Files\IRootFolder;
@@ -52,6 +53,9 @@ class AvatarManager implements IAvatarManager {
/** @var ILogger */
private $logger;
+ /** @var IConfig */
+ private $config;
+
/**
* AvatarManager constructor.
*
@@ -59,16 +63,19 @@ class AvatarManager implements IAvatarManager {
* @param IRootFolder $rootFolder
* @param IL10N $l
* @param ILogger $logger
+ * @param IConfig $config
*/
public function __construct(
IUserManager $userManager,
IRootFolder $rootFolder,
IL10N $l,
- ILogger $logger) {
+ ILogger $logger,
+ IConfig $config) {
$this->userManager = $userManager;
$this->rootFolder = $rootFolder;
$this->l = $l;
$this->logger = $logger;
+ $this->config = $config;
}
/**
@@ -94,6 +101,6 @@ class AvatarManager implements IAvatarManager {
/** @var Folder $folder */
$folder = $this->rootFolder->get($dir);
- return new Avatar($folder, $this->l, $user, $this->logger);
+ return new Avatar($folder, $this->l, $user, $this->logger, $this->config);
}
}
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 6f6d403210d..494387ab6ca 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -361,7 +361,8 @@ class Server extends ServerContainer implements IServerContainer {
$c->getUserManager(),
$c->getRootFolder(),
$c->getL10N('lib'),
- $c->getLogger()
+ $c->getLogger(),
+ $c->getConfig()
);
});
$this->registerService('Logger', function (Server $c) {
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php
index 7e5c120717f..da845d80d04 100644
--- a/lib/private/TemplateLayout.php
+++ b/lib/private/TemplateLayout.php
@@ -112,6 +112,7 @@ class TemplateLayout extends \OC_Template {
$this->assign('userAvatarSet', false);
} else {
$this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
+ $this->assign('userAvatarVersion', \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0));
}
} else if ($renderAs == 'error') {
diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php
index eed9aa7c1a2..0b162b453a0 100644
--- a/lib/public/AppFramework/Http/Response.php
+++ b/lib/public/AppFramework/Http/Response.php
@@ -92,8 +92,7 @@ class Response {
public function cacheFor($cacheSeconds) {
if($cacheSeconds > 0) {
- $this->addHeader('Cache-Control', 'max-age=' . $cacheSeconds .
- ', must-revalidate');
+ $this->addHeader('Cache-Control', 'max-age=' . $cacheSeconds . ', must-revalidate');
} else {
$this->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
}