Merge pull request #16944 from owncloud/fix-avatars

Reintroduce user cache
This commit is contained in:
Thomas Müller 2015-06-15 21:16:04 +02:00
commit e9d11a65e0
6 changed files with 8 additions and 10 deletions

View File

@ -209,8 +209,7 @@ class AvatarController extends Controller {
$resp = new DataDisplayResponse($image->data(),
Http::STATUS_OK,
['Content-Type' => $image->mimeType(),
'Pragma' => 'public']);
['Content-Type' => $image->mimeType()]);
$resp->setETag(crc32($image->data()));
$resp->cacheFor(0);

View File

@ -90,6 +90,7 @@ class Avatar implements \OCP\IAvatar {
* @return void
*/
public function set ($data) {
if($data instanceOf \OCP\IImage) {
$img = $data;
$data = $img->data();

View File

@ -218,8 +218,8 @@ class Server extends SimpleContainer implements IServerContainer {
$this->registerService('AppHelper', function ($c) {
return new \OC\AppHelper();
});
$this->registerService('NullCache', function ($c) {
return new NullCache();
$this->registerService('UserCache', function ($c) {
return new Cache\File();
});
$this->registerService('MemCacheFactory', function (Server $c) {
$config = $c->getConfig();
@ -667,7 +667,7 @@ class Server extends SimpleContainer implements IServerContainer {
* @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache
*/
public function getCache() {
return $this->query('NullCache');
return $this->query('UserCache');
}
/**

View File

@ -94,7 +94,7 @@ class Response {
$this->addHeader('Cache-Control', 'max-age=' . $cacheSeconds .
', must-revalidate');
} else {
$this->addHeader('Cache-Control', 'no-cache, must-revalidate');
$this->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
}
return $this;

View File

@ -221,7 +221,7 @@ class ResponseTest extends \Test\TestCase {
$this->childResponse->cacheFor(0);
$headers = $this->childResponse->getHeaders();
$this->assertEquals('no-cache, must-revalidate', $headers['Cache-Control']);
$this->assertEquals('no-cache, no-store, must-revalidate', $headers['Cache-Control']);
}

View File

@ -98,9 +98,7 @@ class Server extends \Test\TestCase {
['NavigationManager', '\OC\NavigationManager'],
['NavigationManager', '\OCP\INavigationManager'],
['NullCache', '\OC\Memcache\NullCache'],
['NullCache', '\OC\Memcache\Cache'],
['NullCache', '\OCP\IMemcache'],
['UserCache', '\OC\Cache\File'],
['OcsClient', '\OC\OCSClient'],