Contacts+OC_Respone: Move enableCaching out of setEtagHeader and setLastModifiedHeader

This commit is contained in:
Bart Visscher 2012-02-13 22:47:31 +01:00
parent 0fd5252cfc
commit 594dcf13f2
3 changed files with 3 additions and 2 deletions

View File

@ -21,6 +21,7 @@ $image = new OC_Image();
if( is_null($contact)) {
OC_Log::write('contacts','photo.php. The VCard for ID '.$id.' is not RFC compatible',OC_Log::ERROR);
} else {
OC_Response::enableCaching();
OC_Contacts_App::setLastModifiedHeader($contact);
// Photo :-)

View File

@ -48,6 +48,7 @@ if(is_null($contact)){
getStandardImage();
exit();
}
OC_Response::enableCaching();
OC_Contacts_App::setLastModifiedHeader($contact);
$thumbnail_size = 23;

View File

@ -63,6 +63,7 @@ class OC_Response {
$expires->add(new DateInterval($interval));
}
if ($expires instanceof DateTime) {
$expires->setTimezone(new DateTimeZone('GMT'));
$expires = $expires->format(DateTime::RFC2822);
}
header('Expires: '.$expires);
@ -72,7 +73,6 @@ class OC_Response {
if (empty($etag)) {
return;
}
self::enableCaching();
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) &&
trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
self::setStatus(self::STATUS_NOT_MODIFIED);
@ -88,7 +88,6 @@ class OC_Response {
if ($lastModified instanceof DateTime) {
$lastModified = $lastModified->format(DateTime::RFC2822);
}
self::enableCaching();
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
trim($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $lastModified) {
self::setStatus(self::STATUS_NOT_MODIFIED);