Update cache

This commit is contained in:
Romain Neutron
2012-06-01 15:25:34 +02:00
parent ce8679103f
commit a7dfccaaa3

View File

@@ -59,22 +59,15 @@ return call_user_func(
} }
$response = \set_export::stream_file($pathOut, $file->get_file(), $file->get_mime(), 'attachment'); $response = \set_export::stream_file($pathOut, $file->get_file(), $file->get_mime(), 'attachment');
$response->setPrivate();
$cacheOptions = array(
'max_age' => 0,
's_maxage' => 0,
'private' => true,
'public' => false,
);
/* @var $response \Symfony\Component\HttpFoundation\Response */ /* @var $response \Symfony\Component\HttpFoundation\Response */
if ($file->getEtag()) { if ($file->getEtag()) {
$response->setEtag($file->getEtag());
$cacheOptions['etag'] = $file->getEtag(); $response->setLastModified($file->get_modification_date());
$cacheOptions['last_modified'] = $file->get_modification_date();
} }
$response->setCache($cacheOptions); $response->headers->addCacheControlDirective('must-revalidate', true);
$response->isNotModified($request); $response->isNotModified($request);
return $response; return $response;
@@ -209,6 +202,7 @@ return call_user_func(
$app->error(function (\Exception $e) { $app->error(function (\Exception $e) {
var_dump($e->getMessage());
if ($e instanceof \Exception_Session_NotAuthenticated) { if ($e instanceof \Exception_Session_NotAuthenticated) {
$code = 403; $code = 403;
$message = 'Forbidden'; $message = 'Forbidden';